Issue #6539 has been updated by Howard Tyson.
In my testing I've found that if you call the parent (handing in the paremeter)
and then the child (handing in the parameter) it'll work. It's ugly, but it
seems to be a reliable work around so far.
Something like with the example above:
class{'a': m => 'foo' }
class{'b': m => 'foo' }
----------------------------------------
Bug #6539: Inheritance of a parametrized class does not work
https://projects.puppetlabs.com/issues/6539
Author: Peter Meier
Status: Accepted
Priority: High
Assignee: Nick Lewis
Category: parameterized classes
Target version:
Affected Puppet version: 2.6.5
Keywords:
Branch: https://github.com/nicklewis/puppet/tree/ticket/master/6539
Given the following manifest:
<pre>
# cat foo.pp
class a($m){
include c
}
class b inherits a {
include d
notice $m
}
class c {
file{'/tmp/a': content => $a::m }
}
class d inherits c {
File['/tmp/a']{ mode => 0600 }
}
class{'b': m => 'foo' }
</pre>
produces the following error:
<pre>
# puppet --trace foo.pp
/usr/lib/ruby/site_ruby/1.8/puppet/util/errors.rb:60:in `fail'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/resource.rb:313:in `validate'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/resource.rb:98:in `finish'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/resource.rb:70:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:151:in `evaluate_classes'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:142:in `each'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:142:in `evaluate_classes'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/ast/resource.rb:56:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/util/errors.rb:35:in `exceptwrap'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/ast/resource.rb:39:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/ast/resource.rb:38:in `collect'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/ast/resource.rb:38:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/ast.rb:72:in `safeevaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/ast/astarray.rb:35:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/ast/astarray.rb:34:in `collect'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/ast/astarray.rb:34:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/ast.rb:72:in `safeevaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/resource/type.rb:76:in `evaluate_code'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/resource.rb:71:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:290:in `evaluate_main'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:101:in `compile'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:18:in `compile'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:77:in
`compile'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:197:in `benchmark'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:75:in
`compile'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:34:in `find'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/indirection.rb:193:in `find'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector.rb:50:in `find'
/usr/lib/ruby/site_ruby/1.8/puppet/application/apply.rb:115:in `main'
/usr/lib/ruby/site_ruby/1.8/puppet/application/apply.rb:35:in `run_command'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:287:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:393:in `exit_on_fail'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:287:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/util/command_line.rb:55:in `execute'
/usr/bin/puppet:4
/usr/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:21:in `compile'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:77:in
`compile'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:197:in `benchmark'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:75:in
`compile'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:34:in `find'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/indirection.rb:193:in `find'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector.rb:50:in `find'
/usr/lib/ruby/site_ruby/1.8/puppet/application/apply.rb:115:in `main'
/usr/lib/ruby/site_ruby/1.8/puppet/application/apply.rb:35:in `run_command'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:287:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:393:in `exit_on_fail'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:287:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/util/command_line.rb:55:in `execute'
/usr/bin/puppet:4
Invalid parameter m at /tmp/foo.pp:18 on node foo
</pre>
Changing the manifest to:
<pre>
# cat foo.pp
class a($m){
include c
}
class b($m) inherits a {
include d
notice $m
}
class c {
file{'/tmp/a': content => $a::m }
}
class d inherits c {
File['/tmp/a']{ mode => 0600 }
}
class{'b': m => 'foo' }
</pre>
Produces the following error.
<pre>
# puppet --trace foo.pp
/usr/lib/ruby/site_ruby/1.8/puppet/util/errors.rb:60:in `fail'
/usr/lib/ruby/site_ruby/1.8/puppet/resource/type.rb:232:in
`set_resource_parameters'
/usr/lib/ruby/site_ruby/1.8/puppet/resource/type.rb:227:in `each'
/usr/lib/ruby/site_ruby/1.8/puppet/resource/type.rb:227:in
`set_resource_parameters'
/usr/lib/ruby/site_ruby/1.8/puppet/resource/type.rb:74:in `evaluate_code'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/resource.rb:71:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/resource/type.rb:295:in
`evaluate_parent_type'
/usr/lib/ruby/site_ruby/1.8/puppet/resource/type.rb:67:in `evaluate_code'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/resource.rb:71:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:151:in `evaluate_classes'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:142:in `each'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:142:in `evaluate_classes'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/ast/resource.rb:56:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/util/errors.rb:35:in `exceptwrap'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/ast/resource.rb:39:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/ast/resource.rb:38:in `collect'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/ast/resource.rb:38:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/ast.rb:72:in `safeevaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/ast/astarray.rb:35:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/ast/astarray.rb:34:in `collect'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/ast/astarray.rb:34:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/ast.rb:72:in `safeevaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/resource/type.rb:76:in `evaluate_code'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/resource.rb:71:in `evaluate'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:290:in `evaluate_main'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:101:in `compile'
/usr/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:18:in `compile'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:77:in
`compile'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:197:in `benchmark'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:75:in
`compile'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:34:in `find'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/indirection.rb:193:in `find'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector.rb:50:in `find'
/usr/lib/ruby/site_ruby/1.8/puppet/application/apply.rb:115:in `main'
/usr/lib/ruby/site_ruby/1.8/puppet/application/apply.rb:35:in `run_command'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:287:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:393:in `exit_on_fail'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:287:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/util/command_line.rb:55:in `execute'
/usr/bin/puppet:4
/usr/lib/ruby/site_ruby/1.8/puppet/parser/compiler.rb:21:in `compile'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:77:in
`compile'
/usr/lib/ruby/site_ruby/1.8/puppet/util.rb:197:in `benchmark'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:75:in
`compile'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/catalog/compiler.rb:34:in `find'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector/indirection.rb:193:in `find'
/usr/lib/ruby/site_ruby/1.8/puppet/indirector.rb:50:in `find'
/usr/lib/ruby/site_ruby/1.8/puppet/application/apply.rb:115:in `main'
/usr/lib/ruby/site_ruby/1.8/puppet/application/apply.rb:35:in `run_command'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:287:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:393:in `exit_on_fail'
/usr/lib/ruby/site_ruby/1.8/puppet/application.rb:287:in `run'
/usr/lib/ruby/site_ruby/1.8/puppet/util/command_line.rb:55:in `execute'
/usr/bin/puppet:4
Must pass m to Class[A] at /tmp/foo.pp:1 on node foo
</pre>
It seems like there is currently no way to inherit from a parametrized class.
Probably related to #4534
--
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.