Hi all,

I'm using the class below to set the timezone on a Debian system, however there are two things I'm unhappy with.

1) Why do I have to specify a trailing colon after the exec command and when calling timezone::set? If I leave it off I get the very helpful error "Syntax error at '}'; expected '}'"

2) Because of the exec command, /etc/timezone gets overwritten without a backup being made like with other functions. Is there a way to get the file included in the file bucket? I imagine I'd have to add an "onlyif" directive to make sure this only happened if the file contents changed.

I'm using this function-call "design" in a few places so if it can be rewritten in a nicer way I'd like to know as I can then tidy up a few other classes too. This is all I have been able to decipher from the examples I've stumbled across.

Many thanks,
Adam.

-------

class timezone {

  define set($ensure = present) {

    file {
      "/etc/localtime":
        ensure  => symlink,
        target  => "/usr/share/zoneinfo/$name",
      ;
    }

    exec { "/bin/echo '${name}' > /etc/timezone": }

  }

}

-------

include timezone
timezone::set { "Australia/Brisbane": }

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To post to this group, send email to puppet-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to