Issue #11910 has been updated by Charlie Sharpsteen.

Status changed from Accepted to Needs Decision

It is worth noting that, [according to the 
code](https://github.com/puppetlabs/puppet/blob/2.7.9/lib/puppet/parser/compiler.rb#L64-L67),
 stages weren't designed to be used in this way:

<pre>
# Stages should not be inside of classes.  They are always a
# top-level container, regardless of where they appear in the
# manifest.
return if resource.type.to_s.downcase == "stage"
</pre>

Looks like we need to either:

  - Document this behavior and issue an error.

  - Change the way stages work so that defining them inside a class is a valid 
use case.

----------------------------------------
Bug #11910: class with stage resources needs to be declared & parsed before a 
declared class can use one of those stages
https://projects.puppetlabs.com/issues/11910#change-90992

* Author: Ryan Coleman
* Status: Needs Decision
* Priority: Low
* Assignee: 
* Category: parser
* Target version: 
* Affected Puppet version: 2.7.9
* Keywords: stages classes ordering
* Branch: 
----------------------------------------
Assuming the following Puppet code:
<pre>
# stages/manifests/init.pp
class stages {

  stage { 'first': before => Stage['main'] }

}

# notify/manifests/init.pp
class notify {

  notify { "Hello from $module_name!": }

}

# notify/tests/init.pp
class { 'notify':
  stage => 'first',
}

class { 'stages': }
</pre>

The above, when applied as `puppet apply notify/tests/init.pp` results in:
Puppet::Parser::AST::Resource failed with error ArgumentError: Could not find 
stage first specified by Class[Notify]

If I move the stages class declaration to above my notify class, it works. 
Shouldn't parsing order be irrelevant here? If it isn't, I'm not saying it's 
horrible, just unexpected and counter to how the DSL is taught in our master 
training course.


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