Martijn Grendelman
2010-Sep-07 12:35 UTC
[Puppet Users] Module availability, loading order
Hi, I have create the following module: modules/foo `-- manifests |-- definitions | `-- line.pp `-- init.pp $ cat modules/foo/manifests/init.pp import "definitions/*.pp" $ cat modules/foo/manifests/definitions/line.pp define myline($file, $line, $ensure = ''present'') { .... } I try to use the definition in a class: class testfile { file { "/tmp/testfile": ensure => present, } myline { test: file => "/tmp/testfile", line => "# This is a test", ensure => present, } } Now, if I do a catalog run on a fresh client, it errors out like this: err: Could not retrieve catalog from remote server: Error 400 on SERVER: Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type myline at /etc/puppet/manifests/classes/testfile.pp:7 on node martijn. However, if I first do a run /without/ the ''testfile'' class included for the node, and then re-enable it, everything is fine, and the class/define do everything they''re supposed to do. Is the way I am trying to do things supposed to work? What is the reason that this doesn''t work? Is it an issue with loading order? How can I ensure that the module is loaded/available before the ''testfile'' class is evaluated? Thanks, Martijn.
hello, ----- "Martijn Grendelman" <martijn@grendelman.net> wrote:> Hi, > > I have create the following module: > > modules/foo > `-- manifests > |-- definitions > | `-- line.pp > `-- init.pp > > $ cat modules/foo/manifests/init.pp > import "definitions/*.pp" > > $ cat modules/foo/manifests/definitions/line.pp > define myline($file, $line, $ensure = ''present'') { > .... > } > > I try to use the definition in a class: > > class testfile { > > file { "/tmp/testfile": > ensure => present, > } > > myline { test: > file => "/tmp/testfile", > line => "# This is a test", > ensure => present, > } > }You define should be: define foo::myline { .... } and it should be in modules/foo/manifests/myline.pp> Is the way I am trying to do things supposed to work?nope,> What is the reason that this doesn''t work? Is it an issue with loading > order? > > How can I ensure that the module is loaded/available before the > ''testfile'' class is evaluated?name the files as documented. The puppet master will not know to find your file in a weird location in a file not even called the same as the define, you can help it by just sticking to the way puppet is designed[1] to work, and then it will work. [1] http://docs.reductivelabs.com/guides/modules.html -- R.I.Pienaar -- 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.
Martijn Grendelman
2010-Sep-07 13:49 UTC
Re: [Puppet Users] Module availability, loading order
On 07-09-10 14:41, R.I.Pienaar wrote:> You define should be: > > define foo::myline { .... } > > and it should be in modules/foo/manifests/myline.pp > > >> Is the way I am trying to do things supposed to work? > > nope, > >> What is the reason that this doesn''t work? Is it an issue with >> loading order? >> >> How can I ensure that the module is loaded/available before the >> ''testfile'' class is evaluated? > > name the files as documented. The puppet master will not know to find > your file in a weird location in a file not even called the same as the > define, you can help it by just sticking to the way puppet is > designed[1] to work, and then it will work. > > [1] http://docs.reductivelabs.com/guides/modules.htmlThank you, it appears to be working now. It''s probably my own lack of brainpower, but I feel the Puppet documentation could use some more elaborate examples here and there. Best regards, Martijn.
James Turnbull
2010-Sep-07 14:34 UTC
Re: [Puppet Users] Module availability, loading order
Martijn Grendelman wrote:> > It''s probably my own lack of brainpower, but I feel the Puppet > documentation could use some more elaborate examples here and there. >Patches welcomed! http://github.com/reductivelabs/puppet-docs Regards James Turnbull -- Puppet Labs - http://www.puppetlabs.com C: 503-734-8571 -- 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.
Martijn Grendelman
2010-Sep-07 15:20 UTC
Re: [Puppet Users] Module availability, loading order
On 07-09-10 16:34, James Turnbull wrote:> Martijn Grendelman wrote: >> >> It''s probably my own lack of brainpower, but I feel the Puppet >> documentation could use some more elaborate examples here and there. >> > > Patches welcomed! > > http://github.com/reductivelabs/puppet-docsI had a feeling this was going to come my way ;-) However, I hardly feel competent as a Puppet /user/... Best regards, Martijn.
James Turnbull
2010-Sep-07 15:25 UTC
Re: [Puppet Users] Module availability, loading order
Martijn Grendelman wrote:> On 07-09-10 16:34, James Turnbull wrote: >> Martijn Grendelman wrote: >>> It''s probably my own lack of brainpower, but I feel the Puppet >>> documentation could use some more elaborate examples here and there. >>> >> Patches welcomed! >> >> http://github.com/reductivelabs/puppet-docs > > I had a feeling this was going to come my way ;-) However, I hardly feel > competent as a Puppet /user/... > > Best regards, > Martijn. >Or log tickets - with "a better example would be..." http://projects.puppetlabs.com/projects/puppet-docs/issues/new The issue for me is that I know the docs suck in some places but it really helps to get feedback on exactly where and why and what people want. Without that I can rewrite until the cows come home and not give people documentation that meets their needs. Cheers James Turnbull -- Puppet Labs - http://www.puppetlabs.com C: 503-734-8571 -- 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.