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] 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? Thanks a lot, Mohamed. -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Kelsey Hightower
2012-Feb-27 21:27 UTC
Re: [Puppet Users] Could not find node. cannot compile
On Mon, Feb 27, 2012 at 4:17 PM, Mohamed Lrhazi <lrhazi@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] > > 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 first thing we need to do is resolve this error. What do you get when you pass ''nodename.example.com'' to your external node script? What exit code do you get? -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Mohamed Lrhazi
2012-Feb-27 21:32 UTC
[Puppet Users] Re: Could not find node. cannot compile
Chaging my ENC to output this, adding double quotes: nfs_mounts: - ["/data", "fas3319-518.uis.georgetown.edu:/vol/onecrddb_data/test"] and adding a notice($nfs_mounts) to the manifests, gives this log: [daemon.notice] (Scope(Class[Gu_misc])) nfs_mounts: /datafas3319-518.example.com:/vol/onecrddb_data/test [daemon.notice] (Scope(Class[Gu_misc])) nfs_mounts: /data fas3319-518.example.com:/vol/onecrddb_data/test [daemon.err] name is not an hash or array when accessing it with 0 at /etc/puppet/environments/production_ml623/modules/gu_misc/manifests/init.pp:68 on node nodename.example.com [daemon.err] name is not an hash or array when accessing it with 0 at /etc/puppet/environments/production_ml623/modules/gu_misc/manifests/init.pp:68 on node nodename.example.com On Mon, Feb 27, 2012 at 4:17 PM, Mohamed Lrhazi <lrhazi@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] > > 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? > > Thanks a lot, > Mohamed.-- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Mon, Feb 27, 2012 at 1:17 PM, Mohamed Lrhazi <lrhazi@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 Thanks, Nan -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Kelsey Hightower
2012-Feb-27 21:37 UTC
Re: [Puppet Users] Re: Could not find node. cannot compile
On Mon, Feb 27, 2012 at 4:32 PM, Mohamed Lrhazi <lrhazi@gmail.com> wrote:> Chaging my ENC to output this, adding double quotes: > > nfs_mounts: > - ["/data", "fas3319-518.uis.georgetown.edu:/vol/onecrddb_data/test"] > > and adding a notice($nfs_mounts) to the manifests, gives this log: > > [daemon.notice] (Scope(Class[Gu_misc])) nfs_mounts: > /datafas3319-518.example.com:/vol/onecrddb_data/test > [daemon.notice] (Scope(Class[Gu_misc])) nfs_mounts: /data > fas3319-518.example.com:/vol/onecrddb_data/test > > [daemon.err] name is not an hash or array when accessing it with 0 at > > /etc/puppet/environments/production_ml623/modules/gu_misc/manifests/init.pp:68 > on node nodename.example.com > [daemon.err] name is not an hash or array when accessing it with 0 at > > /etc/puppet/environments/production_ml623/modules/gu_misc/manifests/init.pp:68 > on node nodename.example.comOk, so now your ENC is returning data for the node, good. Now you seem to be reference some var $name, but based on your example it seems that you should be using $nfs_mounts. Also, looks like in you ENC it should be: nfs_mounts: ["/data", "fas3319-518.uis.georgetown.edu: /vol/onecrddb_data/test"] -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Kelsey Hightower
2012-Feb-27 21:39 UTC
Re: [Puppet Users] Could not find node. cannot compile
On Mon, Feb 27, 2012 at 4:33 PM, Nan Liu <nan@puppetlabs.com> wrote:> On Mon, Feb 27, 2012 at 1:17 PM, Mohamed Lrhazi <lrhazi@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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Mohamed Lrhazi
2012-Feb-27 23:46 UTC
Re: [Puppet Users] Could not find node. cannot compile
Thank you guys, and thanks Nan. I see my mistakes now. Mohamed. On Mon, Feb 27, 2012 at 4:39 PM, Kelsey Hightower <kelsey@puppetlabs.com> wrote:> On Mon, Feb 27, 2012 at 4:33 PM, Nan Liu <nan@puppetlabs.com> wrote: >> >> On Mon, Feb 27, 2012 at 1:17 PM, Mohamed Lrhazi <lrhazi@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+unsubscribe@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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.