Douglas Garstang
2010-Jul-30 17:19 UTC
[Puppet Users] Parameterised Classes in 2.6.0... still no luck
I downloaded the latest version of puppet 2.6.0 today, and still can''t
get parameterised classes to work. At least, I think it''s 2.6.0... the
version number in the RPM spec file says 0.25.5.
This simple example:
/etc/puppet/manifests/nodes/pax/name01.pax.xxx.com.pp:
node ''name01.pax.xxx.com'' {
class { amodule::afunc: version => "1.0" }
}
/etc/puppet/modules/amodule/manifests/afunc.pp:
class amodule::afunc ( $version ) {
file { "/tmp/foo": ensure => directory; }
}
This causes the following error to be displayed on the client:
Jul 30 03:48:45 s_sys@name01.pax.livegamer.com puppet-agent[15475]:
Could not retrieve catalog from remote server: Error 400 on SERVER:
Could not parse for environment production: Syntax error at
''amodule::afunc''; expected ''}'' at
/etc/puppet/manifests/nodes/pax/name01.pax.xxx.com.pp:9 on node
name01.pax.livegamer.com
The line number is wrong... I removed some comments. But, anyway, this
looks more like a problem with the autoloader finding parameterised
classes. James Turnbull is also telling me that this isn''t a
parameterised class. I''ve read the tersely worded example on the
puppet web site several times, and no matter how many times I read it,
what I have sure as heck looks like a parameterised class to me.
Doug.
--
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.
Ryan Y. Coleman
2010-Jul-30 20:09 UTC
Re: [Puppet Users] Parameterised Classes in 2.6.0... still no luck
I have had success with creating a simple parameterised class (cosign) in
2.6.1.RC1
My class looks like this:
class cosign($version="3.0.2-2") {...} ## This sets a default, you can
omit past "=" to ")".
My node definition looks a little like this:
node "foo.edu" {
class { cosign: version => "3.1.1-1" } ## This actually sets the
overriding variable.
}
I then use the variable to choose which package version to install.
Hope this helps!
--Ryan
----- Original Message -----> From: "Douglas Garstang" <doug.garstang@gmail.com>
> To: "Puppet Users" <puppet-users@googlegroups.com>
> Sent: Friday, July 30, 2010 1:19:16 PM
> Subject: [Puppet Users] Parameterised Classes in 2.6.0... still no luck
> I downloaded the latest version of puppet 2.6.0 today, and still
can''t
> get parameterised classes to work. At least, I think it''s 2.6.0...
the
> version number in the RPM spec file says 0.25.5.
>
> This simple example:
>
> /etc/puppet/manifests/nodes/pax/name01.pax.xxx.com.pp:
> node ''name01.pax.xxx.com'' {
> class { amodule::afunc: version => "1.0" }
> }
>
> /etc/puppet/modules/amodule/manifests/afunc.pp:
> class amodule::afunc ( $version ) {
> file { "/tmp/foo": ensure => directory; }
> }
>
> This causes the following error to be displayed on the client:
>
> Jul 30 03:48:45 s_sys@name01.pax.livegamer.com puppet-agent[15475]:
> Could not retrieve catalog from remote server: Error 400 on SERVER:
> Could not parse for environment production: Syntax error at
> ''amodule::afunc''; expected ''}'' at
> /etc/puppet/manifests/nodes/pax/name01.pax.xxx.com.pp:9 on node
> name01.pax.livegamer.com
>
> The line number is wrong... I removed some comments. But, anyway, this
> looks more like a problem with the autoloader finding parameterised
> classes. James Turnbull is also telling me that this isn''t a
> parameterised class. I''ve read the tersely worded example on the
> puppet web site several times, and no matter how many times I read it,
> what I have sure as heck looks like a parameterised class to me.
>
> Doug.
>
> --
> 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.
Douglas Garstang
2010-Jul-31 17:38 UTC
Re: [Puppet Users] Parameterised Classes in 2.6.0... still no luck
On Fri, Jul 30, 2010 at 1:09 PM, Ryan Y. Coleman <dudeinpa@gmail.com> wrote:> I have had success with creating a simple parameterised class (cosign) in 2.6.1.RC1 > > My class looks like this: > > class cosign($version="3.0.2-2") {...} ## This sets a default, you can omit past "=" to ")". > > My node definition looks a little like this: > > node "foo.edu" { > class { cosign: version => "3.1.1-1" } ## This actually sets the overriding variable. > } > > I then use the variable to choose which package version to install.Strange how it works for you and no one else. What you have above is exactly what I had. It also appears that it''s even more broken if you try and use module autoloading and specify your classes like module::class. Doug. -- 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.
Jeff McCune
2010-Jul-31 18:43 UTC
Re: [Puppet Users] Parameterised Classes in 2.6.0... still no luck
On Saturday, July 31, 2010, Douglas Garstang> > Strange how it works for you and no one else. What you have above is > exactly what I had. It also appears that it''s even more broken if you > try and use module autoloading and specify your classes like > module::class. >Perhaps you missed my post last night but parameterized classes with :: in their name work if you quote the title in the declaration. class { "foo::bar": myparam => "myvalue" } However please take note of the issue I filed on your behalf. I recommend watching the issue so you get updates on the progress. -Jeff -- Jeff McCune http://www.puppetlabs.com/ -- 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.
Douglas Garstang
2010-Aug-02 03:52 UTC
Re: [Puppet Users] Parameterised Classes in 2.6.0... still no luck
On Sat, Jul 31, 2010 at 11:43 AM, Jeff McCune <jeff@puppetlabs.com> wrote:> On Saturday, July 31, 2010, Douglas Garstang >> >> Strange how it works for you and no one else. What you have above is >> exactly what I had. It also appears that it''s even more broken if you >> try and use module autoloading and specify your classes like >> module::class. >> > > Perhaps you missed my post last night but parameterized classes with > :: in their name work if you quote the title in the declaration. > > class { "foo::bar": myparam => "myvalue" } > > However please take note of the issue I filed on your behalf. I > recommend watching the issue so you get updates on the progress. > > -JeffJeff, that was one of the first things I tried. That didn''t help. Did it work for you? Doug -- 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.
Jeff McCune
2010-Aug-02 18:58 UTC
Re: [Puppet Users] Parameterised Classes in 2.6.0... still no luck
On Sun, Aug 1, 2010 at 8:52 PM, Douglas Garstang <doug.garstang@gmail.com> wrote:> Jeff, that was one of the first things I tried. That didn''t help. Did > it work for you?Yes, with a trivial manifest with only one parametrized class. -- Jeff McCune http://www.puppetlabs.com/ -- 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.