Thank you guys, and thanks Nan. I see my mistakes now.

Mohamed.

On Mon, Feb 27, 2012 at 4:39 PM, Kelsey Hightower <kel...@puppetlabs.com> wrote:
> On Mon, Feb 27, 2012 at 4:33 PM, Nan Liu <n...@puppetlabs.com> wrote:
>>
>> On Mon, Feb 27, 2012 at 1:17 PM, Mohamed Lrhazi <lrh...@gmail.com> wrote:
>> > From my ENC, I return something like, for a given node:
>> >
>> >  nfs_mounts:
>> >      - [/data, fas3319-518.example.com:/vol/crddb_data/test]
>> >
>> > and in my manifests I added:
>> >
>> >   define mount_nfs_shares() {
>> >        $mount_point = $name[0]
>> >        $mount_device = $name[1]
>>
>> $name is not an array, but rather just the resource title, so you
>> can't do this, you need to pass parameters to the define such as:
>>
>> define mount_nfs(
>>  $mount_point = $name,
>>  $mount_device
>> ) {
>> ...
>> }
>>
>> This is now a resource which can be declared as:
>>
>> mount_nfs { '/data':
>>  mount_device => 'fas3319-518.example.com:/vol/crddb_data/test',
>> }
>>
>> >        notice("mount_point: ",$mount_point)
>> >        notice("mount_device: ",$mount_device)
>> >
>> >        file{ $mout_point: ensure => directory }
>> >        mount { $mount_point:
>> >            device => $mount_device,
>> >            name => $mount_point,
>> >            require => File[$mount_point],
>> >        }
>> >    }
>> >    mount_nfs_shares { $nfs_mounts: }
>> >
>> > This results in error:
>> >
>> >
>> > Feb 27 16:10:07 pirates puppet-master[16073]: [daemon.err] Could not
>> > find node 'nodename.example.com'; cannot compile
>> >
>> > The idea of course is for me to be able to specify for each node, in
>> > my ENC, a list of NFS mount it needs, and have the corresponding
>> > puppet resources created and compiled for each.
>> >
>> > Why is this not working? And what would be better way of achieve my
>> > goal?
>>
>> Defines are resources, you can not pass resources via ENC. You have
>> two options, create a class that passes the options, or in your
>> example, I think you are looking for something like create_resources
>> function and pass the resources hash to create mount
>
>
> +1
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to puppet-users@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.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@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