If I have something like this in my node file:

daemontools_service::setup {
    'carbon-cache':
        service_name           => 'carbon-cache',
        ....
        extra_envs             => {
            "GRAPHITE_STORAGE_DIR" => "/mnt/statsd-data/graphite-storage"
             "SOMETHING_ELSE"              => "12345"
             "FOO"                                         => "bar"
        };
    'another-service':
         ...etc.
}

and for those "extra_envs" values I want to create files that look like
this:

     carbon-cache/
             env/
                  GRAPHITE_STORAGE_DIR
                  SOMETHING_ELSE
                  FOO

with the *contents* of those files the *values* of the keys above, then I
was hoping I could do something like this:


--------------------------------------------------
class daemontools_service {

      define envdir_file ($name, $value){
            file { "/var/lib/supervise/${service_name}/env/${key}" :
                mode       => 644,
                content    => "$value",
            }
        }

     define setup(
            $service_name,
            $extra_envs={},
      ){
          create_resources(envdir_file, $extra_envs)
           ....
--------------------------------------------------


But I get the error at the create_resources() line.

      can't convert String into Hash

Is this the right approach?  Or is there a more idiomatic way?  Is it even
possible to iterate through a hash like that in puppet?  I see some
indications on the web that this approach might work.

Any suggestions would be appreciated. Thanks!

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


Reply via email to