HI all, we''ve been explicity importing modules since we started working with puppet. We''d like to start using modules autoloading so I followed: p://docs.puppetlabs.com/guides/modules.html which only sys that puppet will load all modules under modulepath. Ok, so I have this modulepath: modulepath /etc/puppet/manifests/services/common/modules:/etc/puppet/manifests/services/workernode/modules/:/etc/puppet/manifests/services/tier_2/modules: ... (Yes, many module paths, but I see no limitation there) My default node includes common_puppet: node default { include common_puppet_conf } and the class is under: # ls /etc/puppet/manifests/services/common/modules common_bacula common_defaults common_puppet common_snmpd common_ssh # grep class /etc/puppet/manifests/services/common/modules/common_puppet/manifests/init.pp # No dependencies with other classes/modules. We need Linux and Solaris conf class common_puppet_conf { So, from my pointof view, puppet should autoload that class, but it doesn''t: # puppetd --test --server ser01-test.pic.es err: Could not retrieve catalog: Could not find class common_puppet_conf at /etc/puppet/manifests/nodes.pp:8 on node tditaller019.pic.es Am I doing something wrong? Cause module autoload seem very easy and it''s not working for me... TIA, Arnau -- 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.
Hi Arnau, Your module folder name is called ''common_puppet'' but you''re class is called ''common_puppet_conf''. Option 1, rename the common_puppet class to common_puppet_conf, as according to your grep, the only class inside common_puppet/init.pp is "class common_puppet_conf". The class definition in init.pp of a module should match the name of the module itself so the auto loader can find it. Option 2, move the class declaration of common_puppet_conf out of init.pp and into common_puppet_conf.pp in the same directory, then you should be able to do this (note the use of the namespace common_puppet, which is your module name): include common_puppet::common_puppet_conf You can then have a common_puppet class, which you can have install Puppet software and start Puppet services. Depends on how you want to organise your modules. HTH, -Luke On Jan 13, 10:29 am, Arnau Bria <arnaub...@pic.es> wrote:> HI all, > > we''ve been explicity importing modules since we started working with puppet. > We''d like to start using modules autoloading so I followed: > p://docs.puppetlabs.com/guides/modules.html > > which only sys that puppet will load all modules under modulepath. Ok, so I > have this modulepath: > modulepath > /etc/puppet/manifests/services/common/modules:/etc/puppet/manifests/services/workernode/modules/:/etc/puppet/manifests/services/tier_2/modules: > ... > > (Yes, many module paths, but I see no limitation there) > > My default node includes common_puppet: > node default { > include common_puppet_conf > > } > > and the class is under: > > # ls /etc/puppet/manifests/services/common/modules > common_bacula common_defaults common_puppet common_snmpd common_ssh > > # grep class > /etc/puppet/manifests/services/common/modules/common_puppet/manifests/init.pp > > # No dependencies with other classes/modules. We need Linux and Solaris conf > class common_puppet_conf { > > So, from my pointof view, puppet should autoload that class, but it doesn''t: > > # puppetd --test --server ser01-test.pic.es > err: Could not retrieve catalog: Could not find class common_puppet_conf at > /etc/puppet/manifests/nodes.pp:8 on node tditaller019.pic.es > > Am I doing something wrong? Cause module autoload seem very easy and it''s > not working for me... > > TIA, > Arnau-- 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 Thu, 13 Jan 2011 02:41:31 -0800 (PST) luke.bigum luke.bigum wrote:> Hi Arnau,Hi Luke,> Your module folder name is called ''common_puppet'' but you''re class is > called ''common_puppet_conf''.Ohhhh!! did not read about this requisite.> Option 1, rename the common_puppet class to common_puppet_conf, as > according to your grep, the only class inside common_puppet/init.pp is > "class common_puppet_conf". The class definition in init.pp of a > module should match the name of the module itself so the auto loader > can find it. > Option 2, move the class declaration of common_puppet_conf out of > init.pp and into common_puppet_conf.pp in the same directory, then you > should be able to do this (note the use of the namespace > common_puppet, which is your module name): > > include common_puppet::common_puppet_conf > > You can then have a common_puppet class, which you can have install > Puppet software and start Puppet services. Depends on how you want to > organise your modules.I''ll choose first option as it''s clearer to me .> HTH, > > -LukeMany thanks for your reply, Luke. Cheers, Arnau -- 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 Jan 13, 2:34 pm, Arnau Bria <arnaub...@pic.es> wrote:> > Option 2, move the class declaration of common_puppet_conf out of > > init.pp and into common_puppet_conf.pp in the same directory, then you > > should be able to do this (note the use of the namespace > > common_puppet, which is your module name): > > > include common_puppet::common_puppet_conf > > > You can then have a common_puppet class, which you can have install > > Puppet software and start Puppet services. Depends on how you want to > > organise your modules. > > I''ll choose first option as it''s clearer to me .Just to give you some examples of auto loading complex modules with multiple classes and how that relates to class names: modules/puppet/init.pp => include puppet modules/puppet/master.pp => include puppet::master modules/puppet/params.pp => include puppet::params modules/puppet/master/something.pp => include puppet::master::something modules/puppet/master/woof.pp => include puppet::master::woof -- 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 Thu, 13 Jan 2011 06:39:28 -0800 (PST) luke.bigum luke.bigum wrote:> Just to give you some examples of auto loading complex modules with > multiple classes and how that relates to class names: > > modules/puppet/init.pp => include puppet > modules/puppet/master.pp => include puppet::master > modules/puppet/params.pp => include puppet::params > modules/puppet/master/something.pp => include > puppet::master::something > modules/puppet/master/woof.pp => include puppet::master::woofThanks again. I''ll probably do that on next future, by now, I still have to "migrate" some old code to new one... I wouldn''t like to mix 2 king of "modules"... Anyway, your examples are self-explanatory. Thanks. cheers, Arnau -- 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.
Felix Frank
2011-Jan-13 16:40 UTC
Re: [Puppet Users] Re: Problems with autoloading modules
> modules/puppet/master/woof.pp => include puppet::master::woofBecause, you know...some puppet masters should really bark at you on occasion :-) [I love it] -- 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.
Nigel Kersten
2011-Jan-13 16:54 UTC
Re: [Puppet Users] Re: Problems with autoloading modules
On Thu, Jan 13, 2011 at 8:33 AM, Arnau Bria <arnaubria@pic.es> wrote:> On Thu, 13 Jan 2011 06:39:28 -0800 (PST) > luke.bigum luke.bigum wrote: > >> Just to give you some examples of auto loading complex modules with >> multiple classes and how that relates to class names: >> >> modules/puppet/init.pp => include puppet >> modules/puppet/master.pp => include puppet::master >> modules/puppet/params.pp => include puppet::params >> modules/puppet/master/something.pp => include >> puppet::master::something >> modules/puppet/master/woof.pp => include puppet::master::woof > > Thanks again. I''ll probably do that on next future, by now, I still have > to "migrate" some old code to new one... I wouldn''t like to mix 2 king > of "modules"... > > Anyway, your examples are self-explanatory. Thanks.Just so people know, we do realize that this is a badly needed snippet of documentation. http://projects.puppetlabs.com/issues/5284> > cheers, > Arnau > > -- > 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.
Daniel Pittman
2011-Jan-13 19:04 UTC
Re: [Puppet Users] Re: Problems with autoloading modules
On Thu, Jan 13, 2011 at 08:54, Nigel Kersten <nigel@puppetlabs.com> wrote:> On Thu, Jan 13, 2011 at 8:33 AM, Arnau Bria <arnaubria@pic.es> wrote: >> On Thu, 13 Jan 2011 06:39:28 -0800 (PST) >> luke.bigum luke.bigum wrote: >> >>> Just to give you some examples of auto loading complex modules with >>> multiple classes and how that relates to class names:[..]> Just so people know, we do realize that this is a badly needed snippet > of documentation. > > http://projects.puppetlabs.com/issues/5284...and I have attached a patch to that ticket, and this email, aiming to improve that. It incorporates these examples and tries to restructure the text to be a bit clearer about the what and how of the whole autoloading thing. Luke, I don''t see a CLA for you (but I confess that I am new at the process of checking that, so please forgive me if you have one already and I messed up.) This change isn''t huge, but it would be nice to get a CLA for you – especially because I hope to steal the credit for ^W^W^W^W incorporate more of your really great explanations into future documentation. You do an amazing job of making things like this clear to people, and I just hope my extra text lives up to the same standard. (We would also love it if you sent us changes to the documentation you wrote, hint, hint. ;) You can sign it through our RedMine system at https://projects.puppetlabs.com/contributor_licenses/sign – which requires a login, but we can get you a faxable version if that is a pain. Anyway, thanks so much for making these contributions to the list. They are great! Regards, Daniel -- ✉ Daniel Pittman <daniel@rimspace.net> ⌨ daniel@rimspace.net (XMPP) ☎ +1 503 893 2285 ♻ made with 100 percent post-consumer electrons -- 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.
Thanks Nigel !, This really needs some enhancement .. On Jan 13, 6:54 pm, Nigel Kersten <ni...@puppetlabs.com> wrote:> On Thu, Jan 13, 2011 at 8:33 AM, Arnau Bria <arnaub...@pic.es> wrote: > > On Thu, 13 Jan 2011 06:39:28 -0800 (PST) > > luke.bigum luke.bigum wrote: > > >> Just to give you some examples of auto loading complex modules with > >> multiple classes and how that relates to class names: > > >> modules/puppet/init.pp => include puppet > >> modules/puppet/master.pp => include puppet::master > >> modules/puppet/params.pp => include puppet::params > >> modules/puppet/master/something.pp => include > >> puppet::master::something > >> modules/puppet/master/woof.pp => include puppet::master::woof > > > Thanks again. I''ll probably do that on next future, by now, I still have > > to "migrate" some old code to new one... I wouldn''t like to mix 2 king > > of "modules"... > > > Anyway, your examples are self-explanatory. Thanks. > > Just so people know, we do realize that this is a badly needed snippet > of documentation. > > http://projects.puppetlabs.com/issues/5284 > > > > > cheers, > > Arnau > > > -- > > 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 athttp://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.
Thanks Nigel !, This really needs some enhancement .. On Jan 13, 6:54 pm, Nigel Kersten <ni...@puppetlabs.com> wrote:> On Thu, Jan 13, 2011 at 8:33 AM, Arnau Bria <arnaub...@pic.es> wrote: > > On Thu, 13 Jan 2011 06:39:28 -0800 (PST) > > luke.bigum luke.bigum wrote: > > >> Just to give you some examples of auto loading complex modules with > >> multiple classes and how that relates to class names: > > >> modules/puppet/init.pp => include puppet > >> modules/puppet/master.pp => include puppet::master > >> modules/puppet/params.pp => include puppet::params > >> modules/puppet/master/something.pp => include > >> puppet::master::something > >> modules/puppet/master/woof.pp => include puppet::master::woof > > > Thanks again. I''ll probably do that on next future, by now, I still have > > to "migrate" some old code to new one... I wouldn''t like to mix 2 king > > of "modules"... > > > Anyway, your examples are self-explanatory. Thanks. > > Just so people know, we do realize that this is a badly needed snippet > of documentation. > > http://projects.puppetlabs.com/issues/5284 > > > > > cheers, > > Arnau > > > -- > > 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 athttp://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.
On Jan 13, 7:04 pm, Daniel Pittman <dan...@rimspace.net> wrote:> Luke, I don''t see a CLA for you (but I confess that I am new at the > process of checking that, so please forgive me if you have one already > and I messed up.) > > This change isn''t huge, but it would be nice to get a CLA for you – > especially because I hope to steal the credit for ^W^W^W^W incorporate > more of your really great explanations into future documentation. You > do an amazing job of making things like this clear to people, and I > just hope my extra text lives up to the same standard. (We would also > love it if you sent us changes to the documentation you wrote, hint, > hint. ;) > > You can sign it through our RedMine system athttps://projects.puppetlabs.com/contributor_licenses/sign– which > requires a login, but we can get you a faxable version if that is a > pain. > > Anyway, thanks so much for making these contributions to the list. > They are great! > > Regards, > DanielNo problem at all - CLA (digitally) signed. I like that you''re using different class include notations, my only suggestion is to comment the types of includes you''re doing so people who are unfamiliar with the different methods aren''t confused: #a simple class include, the class name is the same as the module name include puppet => modules/puppet/manifests/init.pp # class puppet { ... #including a class nested in a module''s namespace include puppet::master => modules/puppet/manifests/master.pp # class puppet::master { ... #defines can be done the same way, note the module namespace #in the define''s name. puppet::params { "example": value => ''meow'' } => modules/puppet/manifests/params.pp # define puppet::params ($value) { ... #a class nested several levels deep into a module. #Note the use of the parameterised class syntax makes no difference. class { "puppet::master::awesome": } => modules/puppet/manifests/master/awesome.pp # class puppet::master::awesome { ... Lastly, I actually don''t know what takes precedence over these two manifest paths or what the preferred method is (or if the second one would even work?) so maybe something about that too: modules/puppet/manifests/master.pp modules/puppet/manifests/master/init.pp -- 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.