Issue #5045 has been updated by Paul Berry.

I see what you're getting at, Dan, but unfortunately, YAML doesn't work that 
way.  Ruby interprets your example like this:

<pre>
{"classes"=>["foo", {"param"=>"value", "foo_with_params"=>nil}]}
</pre>

Which is not what was meant.

I think my proposal addresses backward compatibility already ("For backward 
compatibility we should also support the old format; if “classes” is an array, 
then all the classes are interpreted as taking no parameters.")  Shouldn't that 
be sufficient?
----------------------------------------
Bug #5045: External node classifiers should be able to specify parameters for 
parameterized classes
https://projects.puppetlabs.com/issues/5045

Author: Paul Berry
Status: Accepted
Priority: Normal
Assignee: Paul Berry
Category: language
Target version: 2.6.x
Affected Puppet version: 
Keywords: parameterized_classes
Branch: 


Currently, parameterized classes cannot be invoked by an external node 
classifier because there is no way to specify parameters.  For example:

Manifest:
<pre>
class foo($customizeable_file_name) {
  file { $customizeable_file_name: ensure => present }
}
</pre>

Data output by external node classifier:
<pre>
--- 
parameters: {}

classes: 
- foo
</pre>

This produces the error message:
<pre>
Must pass customizeable_file_name to Class[Foo] at ...
</pre>

I propose that we change the format for data returned by the external node 
classifier so that "classes" is a hash rather than an array, where each key is 
a class to invoke, and the corresponding value is a hash of parameters to pass 
to the class.  Non-parameterized classes can use a value of either {} or nil.

For example:
<pre>
--- 
parameters: {}

classes: 
  parameterized_class: 
    param: value
  normal_class_1: {}

  normal_class_2: 
</pre>

For backward compatibility we should also support the old format; if "classes" 
is an array, then all the classes are interpreted as taking no parameters.


-- 
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