On Wed, Jul 28, 2010 at 4:13 PM, Douglas Garstang
<doug.garst...@gmail.com> wrote:
> Has anyone gotten parameterised classes to work in puppet 2.6 yet?
>
> No luck for me... Seems to be totally broken but I haven't had a
> chance to file a bug against it yet.
>
> Doug

So, I've been playing with this myself.

Seems the second class you try and declare always throws an error,
which isn't so useful.

Consider this trivial manifest:
# Namespace example
class my::funclass($message1, $message2="I'm the default") {
  notify { "greeting":
    message => "message1=[${message1}] message2=[${message2}]";
  }
}
class { "my::funclass":
  message1 => "Hello world",
  message2 => "I'm NOT the default";
}

puppet apply will return the following (good) output:
notice: message1=[Hello world] message2=[I'm NOT the default]
notice: /Stage[main]/My::Funclass/Notify[greeting]/message: defined
'message' as 'message1=[Hello world] message2=[I'm NOT the default]'

Now, if you add a second class and declare it, it won't work...  I
just appended to the file:
class another($color) {
  notify { "color": message => "Color is [${color}]" }
}
class { "another": color => "green" }

And I get this back:
Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid
resource type class at
/Users/jeff/plabs/puppet-samples/manifests/paramclass_twoclass.pp:15
on node danu.local

Line 15 is where class { "another": color => "green" } is declared.

If you swap the two classes, the error happens on the second declaration again.

So...  congrats, you're right, parameterized classes appear to be
rather broken in 2.6.0 and 2.6.1rc1.

Doug, would you mind filing this issue along with the information I've
discovered?  If so, I'll go ahead and do it for you.

Thanks,
-- 
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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to