RedHotChiliPepper
2013-Aug-23 22:09 UTC
[Puppet Users] Unable to declare a parameterized class
I have the following manifests #/etc/puppet/modules/morefangs/manifests/init.pp class morefangs {} #/etc/puppet/modules/morefangs/manifests/one.pp class one { file {''/tmp/one'': ensure => present, content => ''moot'', } } #/etc/puppet/modules/morefangs/manifests/two.pp class two { file {''/tmp/two'': ensure => present, content => ''moot'', } } #/etc/puppet/modules/morefangs/manifests/site.pp include one include two When I run puppet apply /etc/puppet/modules/morefangs/manifests/site.pp I get the following error Could not find class one for ec2.compute-1.amazonaws.com at /etc/puppet/modules/morefangs/manifests/site.pp:3 on node ec2.compute-1.amazonaws.com How can I declare this class using the parameterized class syntax and the include syntax? -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
François Lafont
2013-Aug-23 23:05 UTC
Re: [Puppet Users] Unable to declare a parameterized class
Hi, Le 24/08/2013 00:09, RedHotChiliPepper a écrit :> I have the following manifests > > #/etc/puppet/modules/morefangs/manifests/init.pp > class morefangs {} > > #/etc/puppet/modules/morefangs/manifests/one.pp > class one { > file {''/tmp/one'': > ensure => present, > content => ''moot'', > } > } > > #/etc/puppet/modules/morefangs/manifests/two.pp > class two { > file {''/tmp/two'': > ensure => present, > content => ''moot'', > } > } > > #/etc/puppet/modules/morefangs/manifests/site.pp > include one > include two > > When I run > > puppet apply /etc/puppet/modules/morefangs/manifests/site.pp > > I get the following errorPerhaps this? include morefangs::one include morefangs::two> How can I declare this class using the parameterized class syntax and > the include syntax?For the parameterized syntax, I''m not sure but perhaps: class { ''morefangs::one'': } class { ''morefangs::two'': } HTH. -- François Lafont -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
Dan White
2013-Aug-24 00:32 UTC
Re: [Puppet Users] Unable to declare a parameterized class
Two problems: One: http://docs.puppetlabs.com/guides/parameterized_classes.html Your classes have no parameters. Example from the link: class webserver( $vhost_dir, $packages ) { package { $packages: ensure => present } file { ''vhost_dir'': path => $vhost_dir, ensure => directory, mode => ''0750'', owner => ''www-data'', group => ''root'', } } $vhost_dir and $packages are the parameters Two: http://docs.puppetlabs.com/puppet/3/reference/lang_classes.html "Classes are named blocks of Puppet code, which are stored in modules for later use and are not applied until they are invoked by name.” You are declaring your classes in your site manifest. I hope this helps. On Aug 23, 2013, at 6:09 PM, RedHotChiliPepper wrote:> I have the following manifests > > #/etc/puppet/modules/morefangs/manifests/init.pp > class morefangs {} > > #/etc/puppet/modules/morefangs/manifests/one.pp > class one { > file {''/tmp/one'': > ensure => present, > content => ''moot'', > } > } > > #/etc/puppet/modules/morefangs/manifests/two.pp > class two { > file {''/tmp/two'': > ensure => present, > content => ''moot'', > } > } > > #/etc/puppet/modules/morefangs/manifests/site.pp > include one > include two > > When I run > > puppet apply /etc/puppet/modules/morefangs/manifests/site.pp > > I get the following error > > Could not find class one for ec2.compute-1.amazonaws.com at /etc/puppet/modules/morefangs/manifests/site.pp:3 on node ec2.compute-1.amazonaws.com > > > How can I declare this class using the parameterized class syntax and the include syntax? > > > -- > You received this message because you are subscribed to the Google Groups "Puppet Users" group. > To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. > To post to this group, send email to puppet-users@googlegroups.com. > Visit this group at http://groups.google.com/group/puppet-users. > For more options, visit https://groups.google.com/groups/opt_out.-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
RedHotChiliPepper
2013-Aug-26 14:52 UTC
Re: [Puppet Users] Unable to declare a parameterized class
Hi Francois - I tried both syntaxes separately include morefangs::one include morefangs::two class { ''morefangs::one'' : } class { ''morefangs::two'' : } and still got the same error message Could not find class one for ec2.compute-1.amazonaws.com at /etc/puppet/modules/morefangs/manifests/site.pp:3 on node ec2.compute-1.amazonaws.com On Friday, August 23, 2013 7:05:07 PM UTC-4, François Lafont wrote:> > Hi, > > Le 24/08/2013 00:09, RedHotChiliPepper a écrit : > > > I have the following manifests > > > > #/etc/puppet/modules/morefangs/manifests/init.pp > > class morefangs {} > > > > #/etc/puppet/modules/morefangs/manifests/one.pp > > class one { > > file {''/tmp/one'': > > ensure => present, > > content => ''moot'', > > } > > } > > > > #/etc/puppet/modules/morefangs/manifests/two.pp > > class two { > > file {''/tmp/two'': > > ensure => present, > > content => ''moot'', > > } > > } > > > > #/etc/puppet/modules/morefangs/manifests/site.pp > > include one > > include two > > > > When I run > > > > puppet apply /etc/puppet/modules/morefangs/manifests/site.pp > > > > I get the following error > > Perhaps this? > > include morefangs::one > include morefangs::two > > > How can I declare this class using the parameterized class syntax and > > the include syntax? > > For the parameterized syntax, I''m not sure but perhaps: > > class { ''morefangs::one'': } > class { ''morefangs::two'': } > > HTH. > > -- > François Lafont >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
RedHotChiliPepper
2013-Aug-26 14:57 UTC
Re: [Puppet Users] Unable to declare a parameterized class
Hi Ygor - Can you ever declare a class with no parameters using the following syntax? class { ''morefangs::one'' : } I am new to puppet, are class declarations not allowed in site.pp? I renamed site.pp to test.pp but when I tried to apply the test.pp manifest I got the same exact error. Can you instruct me on how to invoke these classes outside of the class file one.pp and two.pp? Thanks for your assistance. On Friday, August 23, 2013 8:32:57 PM UTC-4, Ygor wrote:> > Two problems: > > One: http://docs.puppetlabs.com/guides/parameterized_classes.html > > Your classes have no parameters. > > Example from the link: > > class webserver( $vhost_dir, $packages ) { > > package { $packages: ensure => present } > > file { ''vhost_dir'': > path => $vhost_dir, > ensure => directory, > mode => ''0750'', > owner => ''www-data'', > group => ''root'', > } > } > > $vhost_dir and $packages are the parameters > > Two: http://docs.puppetlabs.com/puppet/3/reference/lang_classes.html > > "Classes are named blocks of Puppet code, which are stored in modules for > later use and are not applied until they are invoked by name.” > > You are declaring your classes in your site manifest. > > I hope this helps. > > On Aug 23, 2013, at 6:09 PM, RedHotChiliPepper wrote: > > I have the following manifests > > #/etc/puppet/modules/morefangs/manifests/init.pp > class morefangs {} > > #/etc/puppet/modules/morefangs/manifests/one.pp > class one { > file {''/tmp/one'': > ensure => present, > content => ''moot'', > } > } > > #/etc/puppet/modules/morefangs/manifests/two.pp > class two { > file {''/tmp/two'': > ensure => present, > content => ''moot'', > } > } > > #/etc/puppet/modules/morefangs/manifests/site.pp > include one > include two > > When I run > > puppet apply /etc/puppet/modules/morefangs/manifests/site.pp > > I get the following error > > Could not find class one for ec2.compute-1.amazonaws.com at > /etc/puppet/modules/morefangs/manifests/site.pp:3 on node > ec2.compute-1.amazonaws.com > > How can I declare this class using the parameterized class syntax and > the include syntax? > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to puppet-users...@googlegroups.com <javascript:>. > To post to this group, send email to puppet...@googlegroups.com<javascript:> > . > Visit this group at http://groups.google.com/group/puppet-users. > For more options, visit https://groups.google.com/groups/opt_out. > > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
Dan White
2013-Aug-26 15:39 UTC
Re: [Puppet Users] Unable to declare a parameterized class
Your syntax is fine. The way you are putting the bits together is very messed up. It seems to me that you need some basic understanding of Puppet and how it works and how to use it. Try these links: http://finninday.net/wiki/index.php/Zero_to_puppet_in_one_day http://docs.puppetlabs.com/learning/ “Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.” Bill Waterson (Calvin & Hobbes) ----- Original Message ----- From: "RedHotChiliPepper" <sharrukinjosephson@gmail.com> To: puppet-users@googlegroups.com Sent: Monday, August 26, 2013 10:57:06 AM Subject: Re: [Puppet Users] Unable to declare a parameterized class Hi Ygor - Can you ever declare a class with no parameters using the following syntax? class { ''morefangs::one'' : } I am new to puppet, are class declarations not allowed in site.pp? I renamed site.pp to test.pp but when I tried to apply the test.pp manifest I got the same exact error. Can you instruct me on how to invoke these classes outside of the class file one.pp and two.pp? Thanks for your assistance. On Friday, August 23, 2013 8:32:57 PM UTC-4, Ygor wrote: Two problems: One: http://docs.puppetlabs.com/guides/parameterized_classes.html Your classes have no parameters. Example from the link: class webserver( $vhost_dir, $packages ) { package { $packages: ensure => present } file { ''vhost_dir'': path => $vhost_dir, ensure => directory, mode => ''0750'', owner => ''www-data'', group => ''root'', } } $vhost_dir and $packages are the parameters Two: http://docs.puppetlabs.com/puppet/3/reference/lang_classes.html "Classes are named blocks of Puppet code, which are stored in modules for later use and are not applied until they are invoked by name.” You are declaring your classes in your site manifest. I hope this helps. On Aug 23, 2013, at 6:09 PM, RedHotChiliPepper wrote: I have the following manifests #/etc/puppet/modules/morefangs/manifests/init.pp class morefangs {} #/etc/puppet/modules/morefangs/manifests/one.pp class one { file {''/tmp/one'': ensure => present, content => ''moot'', } } #/etc/puppet/modules/morefangs/manifests/two.pp class two { file {''/tmp/two'': ensure => present, content => ''moot'', } } #/etc/puppet/modules/morefangs/manifests/site.pp include one include two When I run puppet apply /etc/puppet/modules/morefangs/manifests/site.pp I get the following error Could not find class one for ec2.compute-1.amazonaws.com at /etc/puppet/modules/morefangs/manifests/site.pp:3 on node ec2.compute-1.amazonaws.com How can I declare this class using the parameterized class syntax and the include syntax? -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com . To post to this group, send email to puppet...@googlegroups.com . Visit this group at http://groups.google.com/group/puppet-users . For more options, visit https://groups.google.com/groups/opt_out . -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users . For more options, visit https://groups.google.com/groups/opt_out . -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
RedHotChiliPepper
2013-Aug-26 16:04 UTC
Re: [Puppet Users] Unable to declare a parameterized class
Thanks Ygor - I''m currently on the Variables, Conditionals and Facts section of the second link you provided. Can *anyone* who is reading this post please give me a high level understanding of how I''m "putting the bits together" incorrectly? I''m really struggling to understand why I''m getting this error message even though my syntax is correct. Thanks so much On Monday, August 26, 2013 11:39:04 AM UTC-4, Ygor wrote:> > Your syntax is fine. The way you are putting the bits together is very > messed up. > > It seems to me that you need some basic understanding of Puppet and how it > works and how to use it. > > Try these links: > http://finninday.net/wiki/index.php/Zero_to_puppet_in_one_day > http://docs.puppetlabs.com/learning/ > > “Sometimes I think the surest sign that intelligent life exists elsewhere > in the universe is that none of it has tried to contact us.” > Bill Waterson (Calvin & Hobbes) > > ----- Original Message ----- > From: "RedHotChiliPepper" <sharrukin...@gmail.com <javascript:>> > To: puppet...@googlegroups.com <javascript:> > Sent: Monday, August 26, 2013 10:57:06 AM > Subject: Re: [Puppet Users] Unable to declare a parameterized class > > > Hi Ygor - > > > Can you ever declare a class with no parameters using the following > syntax? > class { ''morefangs::one'' : } > > > > I am new to puppet, are class declarations not allowed in site.pp? I > renamed site.pp to test.pp but when I tried to apply the test.pp manifest I > got the same exact error. Can you instruct me on how to invoke these > classes outside of the class file one.pp and two.pp? > > > Thanks for your assistance. > > > > On Friday, August 23, 2013 8:32:57 PM UTC-4, Ygor wrote: > > > Two problems: > > > One: http://docs.puppetlabs.com/guides/parameterized_classes.html > > > Your classes have no parameters. > > > Example from the link: > > > > class webserver( $vhost_dir, $packages ) { > > package { $packages: ensure => present } > > file { ''vhost_dir'': > path => $vhost_dir, > ensure => directory, > mode => ''0750'', > owner => ''www-data'', > group => ''root'', > } > } > > > $vhost_dir and $packages are the parameters > > > Two: http://docs.puppetlabs.com/puppet/3/reference/lang_classes.html > > > "Classes are named blocks of Puppet code, which are stored in modules for > later use and are not applied until they are invoked by name.” > > > You are declaring your classes in your site manifest. > > > I hope this helps. > > > > > On Aug 23, 2013, at 6:09 PM, RedHotChiliPepper wrote: > > > > > > I have the following manifests > > #/etc/puppet/modules/morefangs/manifests/init.pp > class morefangs {} > > #/etc/puppet/modules/morefangs/manifests/one.pp > class one { > file {''/tmp/one'': > ensure => present, > content => ''moot'', > } > } > > #/etc/puppet/modules/morefangs/manifests/two.pp > class two { > file {''/tmp/two'': > ensure => present, > content => ''moot'', > } > } > > #/etc/puppet/modules/morefangs/manifests/site.pp > include one > include two > > When I run > > puppet apply /etc/puppet/modules/morefangs/manifests/site.pp > > I get the following error > > Could not find class one for ec2.compute-1.amazonaws.com at > /etc/puppet/modules/morefangs/manifests/site.pp:3 on node > ec2.compute-1.amazonaws.com > > > > How can I declare this class using the parameterized class syntax and the > include syntax? > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to puppet-users...@googlegroups.com . > To post to this group, send email to puppet...@googlegroups.com . > Visit this group at http://groups.google.com/group/puppet-users . > For more options, visit https://groups.google.com/groups/opt_out . > > > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to puppet-users...@googlegroups.com <javascript:>. > To post to this group, send email to puppet...@googlegroups.com<javascript:>. > > Visit this group at http://groups.google.com/group/puppet-users . > For more options, visit https://groups.google.com/groups/opt_out . >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
jcbollinger
2013-Aug-27 17:56 UTC
Re: [Puppet Users] Unable to declare a parameterized class
On Friday, August 23, 2013 7:32:57 PM UTC-5, Ygor wrote:> > Two problems: > > One: http://docs.puppetlabs.com/guides/parameterized_classes.html > > Your classes have no parameters. > >This is not a problem. Classes do not have to have parameters, and when they do not, they can omit the parentheses around the empty parameter list. That syntax predates parameterized classes, in fact.> > > Two: http://docs.puppetlabs.com/puppet/3/reference/lang_classes.html > > "Classes are named blocks of Puppet code, which are stored in modules for > later use and are not applied until they are invoked by name.” > > You are declaring your classes in your site manifest. > >That is not a problem either. It''s perfectly valid to declare classes at top level. There are two problems. First, your class definitions should give their full names. You seem to be trying to put them into a module (good for you), so their correct names would have the module name as a namespace prefix, for example: #/etc/puppet/modules/morefangs/manifests/one.pp class morefangs::one { file {''/tmp/one'': ensure => present, content => ''moot'', } } Then, when you declare the classes you specify their fully-qualified names: include ''morefangs::one'' include ''morefangs::two'' (from anywhere). That''s what allows Puppet to find the .pp file wherein each class is defined, provided that the class it finds therein in fact bears requested name. The clue here was Puppet''s message, "Could not *find* class one" (emphasis added). The code you posted was (all) valid, and not really so far off from what you wanted. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.