Issue #4423 has been updated by Markus Roberts.

Status changed from Ready for Testing to Closed

commit:1faebdd7b54a55b023f151976644dbc3405c486b [#4423] repair parameterized 
class instantiation

----------------------------------------
Bug #4423: Cannot declare two parameterized classes
http://projects.puppetlabs.com/issues/4423

Author: Jeff McCune
Status: Closed
Priority: Normal
Assigned to: Markus Roberts
Category: parser
Target version: 2.6.1
Affected version: 2.6.1rc1
Keywords: parameterized classes, parameter, class parameterised, ast, parser, 
Branch: http://github.com/jes5199/puppet/tree/ticket/2.6.x/4423-tested


Overview:
The second declaration of a class accepting parameters bombs out.

Detailed information.

Copied from puppet-users mailing list.

On Wed, Jul 28, 2010 at 4:13 PM, Douglas Garstang
<[email protected]> 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 (Note I'm only defining and declaring one class)
    # 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 it's not a syntax problem.

Steps to reproduce:

Define two classes with parameters, then try and use them passing in parameters.

Acceptance test will follow shortly.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to