Issue #7287 has been updated by Charlie Sharpsteen.

Status changed from Accepted to Rejected
Assignee set to Charlie Sharpsteen
Affected Puppet version deleted (2.6.8rc1)

This has nothing to do with stages.

On line 3 of your example a parameterized class is declared taking one 
variable, `$bazvar`, for which no default value is given. On line 2 an instance 
of that class is declared and without providing a value for `$bazvar` the 
compiler throws an error as no default is available.

----------------------------------------
Bug #7287: Parameterized classes can't be assigned to stages
https://projects.puppetlabs.com/issues/7287#change-90988

* Author: Matt Robinson
* Status: Rejected
* Priority: Normal
* Assignee: Charlie Sharpsteen
* Category: 
* Target version: 
* Affected Puppet version: 
* Keywords: parameterized_class parameterised parameterized class stage stages 
run runstage parameterized_classes
* Branch: 
----------------------------------------
Maybe there's a different way to put a parameterized class in a stage, but so 
far the only way I've seen is what's in the documentation (below) and by making 
stage a parameter to a class (which only recently works as of #4655
http://docs.puppetlabs.com/guides/language_guide.html#parameterised-classes
http://docs.puppetlabs.com/guides/language_guide.html#run-stages

    stage { pre: before => Stage[main] }
    class { "baz": stage => pre; }
    class baz($bazvar) { notice("in class baz and my var is $bazvar") }

Running this manifest results in the following error:

    Must pass bazvar to Class[Baz] at 
/Users/matthewrobinson/puppet_examples/stages_parametrized_classes.pp:3 on node 
mattmac.local

Here's the associated stack trace:

    /Users/matthewrobinson/work/puppet/lib/puppet/util/errors.rb:60:in `fail'
    /Users/matthewrobinson/work/puppet/lib/puppet/resource/type.rb:253:in 
`set_resource_parameters'
    /Users/matthewrobinson/work/puppet/lib/puppet/resource/type.rb:248:in `each'
    /Users/matthewrobinson/work/puppet/lib/puppet/resource/type.rb:248:in 
`set_resource_parameters'
    /Users/matthewrobinson/work/puppet/lib/puppet/resource/type.rb:72:in 
`evaluate_code'
    /Users/matthewrobinson/work/puppet/lib/puppet/parser/resource.rb:71:in 
`evaluate'
    /Users/matthewrobinson/work/puppet/lib/puppet/parser/compiler.rb:161:in 
`evaluate_classes'
    /Users/matthewrobinson/work/puppet/lib/puppet/parser/compiler.rb:148:in 
`each'
    /Users/matthewrobinson/work/puppet/lib/puppet/parser/compiler.rb:148:in 
`evaluate_classes'
    /Users/matthewrobinson/work/puppet/lib/puppet/parser/ast/resource.rb:60:in 
`evaluate'
    /Users/matthewrobinson/work/puppet/lib/puppet/util/errors.rb:35:in 
`exceptwrap'
    /Users/matthewrobinson/work/puppet/lib/puppet/parser/ast/resource.rb:43:in 
`evaluate'
    /Users/matthewrobinson/work/puppet/lib/puppet/parser/ast/resource.rb:42:in 
`collect'
    /Users/matthewrobinson/work/puppet/lib/puppet/parser/ast/resource.rb:42:in 
`evaluate'
    /Users/matthewrobinson/work/puppet/lib/puppet/util/autoload.rb:79:in 
`collect'
    /Users/matthewrobinson/work/puppet/lib/puppet/parser/ast/branch.rb:16:in 
`each'
    /Users/matthewrobinson/work/puppet/lib/puppet/parser/ast/branch.rb:15:in 
`each'
    /Users/matthewrobinson/work/puppet/lib/puppet/parser/ast/resource.rb:25:in 
`collect'
    /Users/matthewrobinson/work/puppet/lib/puppet/parser/ast/resource.rb:25:in 
`evaluate'
    /Users/matthewrobinson/work/puppet/lib/puppet/parser/ast.rb:76:in 
`safeevaluate'
    /Users/matthewrobinson/work/puppet/lib/puppet/parser/ast/astarray.rb:25:in 
`evaluate'
    /Users/matthewrobinson/work/puppet/lib/puppet/parser/ast/astarray.rb:20:in 
`each'
    /Users/matthewrobinson/work/puppet/lib/puppet/parser/ast/astarray.rb:20:in 
`evaluate'
    /Users/matthewrobinson/work/puppet/lib/puppet/parser/ast.rb:76:in 
`safeevaluate'
    /Users/matthewrobinson/work/puppet/lib/puppet/resource/type.rb:74:in 
`evaluate_code'
    /Users/matthewrobinson/work/puppet/lib/puppet/parser/resource.rb:71:in 
`evaluate'
    /Users/matthewrobinson/work/puppet/lib/puppet/parser/compiler.rb:297:in 
`evaluate_main'
    /Users/matthewrobinson/work/puppet/lib/puppet/parser/compiler.rb:101:in 
`compile'
    /Users/matthewrobinson/work/puppet/lib/puppet/parser/compiler.rb:18:in 
`compile'
    
/Users/matthewrobinson/work/puppet/lib/puppet/indirector/catalog/compiler.rb:78:in
 `compile'
    /Users/matthewrobinson/work/puppet/lib/puppet/util.rb:198:in `benchmark'
    
/Users/matthewrobinson/work/puppet/lib/puppet/indirector/catalog/compiler.rb:76:in
 `compile'
    
/Users/matthewrobinson/work/puppet/lib/puppet/indirector/catalog/compiler.rb:35:in
 `find'
    
/Users/matthewrobinson/work/puppet/lib/puppet/indirector/indirection.rb:188:in 
`find'
    /Users/matthewrobinson/work/puppet/lib/puppet/application/apply.rb:198:in 
`main'
    /Users/matthewrobinson/work/puppet/lib/puppet/application/apply.rb:134:in 
`run_command'
    /Users/matthewrobinson/work/puppet/lib/puppet/application.rb:307:in `run'
    /Users/matthewrobinson/work/puppet/lib/puppet/application.rb:411:in `hook'
    /Users/matthewrobinson/work/puppet/lib/puppet/application.rb:307:in `run'
    /Users/matthewrobinson/work/puppet/lib/puppet/application.rb:402:in 
`exit_on_fail'
    /Users/matthewrobinson/work/puppet/lib/puppet/application.rb:307:in `run'
    /Users/matthewrobinson/work/puppet/lib/puppet/util/command_line.rb:62:in 
`execute'
    /Users/matthewrobinson/work/puppet/bin/puppet:4
    /Users/matthewrobinson/work/puppet/lib/puppet/parser/compiler.rb:21:in 
`compile'
    
/Users/matthewrobinson/work/puppet/lib/puppet/indirector/catalog/compiler.rb:78:in
 `compile'
    /Users/matthewrobinson/work/puppet/lib/puppet/util.rb:198:in `benchmark'
    
/Users/matthewrobinson/work/puppet/lib/puppet/indirector/catalog/compiler.rb:76:in
 `compile'
    
/Users/matthewrobinson/work/puppet/lib/puppet/indirector/catalog/compiler.rb:35:in
 `find'
    
/Users/matthewrobinson/work/puppet/lib/puppet/indirector/indirection.rb:188:in 
`find'
    /Users/matthewrobinson/work/puppet/lib/puppet/application/apply.rb:198:in 
`main'
    /Users/matthewrobinson/work/puppet/lib/puppet/application/apply.rb:134:in 
`run_command'
    /Users/matthewrobinson/work/puppet/lib/puppet/application.rb:307:in `run'
    /Users/matthewrobinson/work/puppet/lib/puppet/application.rb:411:in `hook'
    /Users/matthewrobinson/work/puppet/lib/puppet/application.rb:307:in `run'
    /Users/matthewrobinson/work/puppet/lib/puppet/application.rb:402:in 
`exit_on_fail'
    /Users/matthewrobinson/work/puppet/lib/puppet/application.rb:307:in `run'
    /Users/matthewrobinson/work/puppet/lib/puppet/util/command_line.rb:62:in 
`execute'
    /Users/matthewrobinson/work/puppet/bin/puppet:4
    


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to