In regard to: [Puppet Users] How to use create_resources with a define,...:

I have not used the create_resources function before, looks like
exactly what I need indeed.

How do I use it with a define.. my ENC outputs something like:

 nfs_mounts:
       - mount_point: "/data"
         mount_device: "fas3319-518.example.com:/vol/onecrddb_data/test"
       - mount_point: "/data2"
         mount_device: "fas3319-518.example.com:/vol/onecrddb_data/test2"

I'm pretty new to puppet, but a (more experienced) coworker and I just
ran into something nearly identical with hiera/YAML a couple days ago.

I believe the issue is that your ENC is outputting an array, not a hash,
and create_resources works on hashes.

If you can get your ENC to output a hash, you'll likely have better luck.

class gu_misc {
...

 define mount_nfs_shares(
       $mount_point,
       $mount_device) {

       file{ $mout_point: ensure => directory }
       mount { $mount_point:
           device => $mount_device,
           name => $mount_point,
           require => File[$mount_point],
       }
   }

   create_resources(gu_misc::mount_nfs_shares, $nfs_mounts)

}

I get error: undefined method `[]' for nil:NilClass

Tim
--
Tim Mooney                                             [email protected]
Enterprise Computing & Infrastructure                  701-231-1076 (Voice)
Room 242-J6, IACC Building                             701-231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164

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

Reply via email to