summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/compiler.rb
diff options
context:
space:
mode:
authorDaniel Pittman <daniel@puppetlabs.com>2011-05-12 11:46:17 -0700
committerDaniel Pittman <daniel@puppetlabs.com>2011-05-12 11:46:17 -0700
commit1f438da968e1583d900903407c2e5b17648fa937 (patch)
tree8d402af900458792a0cb516b2c903578fb592b7d /lib/puppet/parser/compiler.rb
parente059539a0d7bfc33f80b003894a1a2d807e85851 (diff)
parent8f907f21c05295a4e04a55e2d0b287454eea4773 (diff)
downloadpuppet-1f438da968e1583d900903407c2e5b17648fa937.tar.gz
puppet-1f438da968e1583d900903407c2e5b17648fa937.tar.xz
puppet-1f438da968e1583d900903407c2e5b17648fa937.zip
Merge branch '2.6.next' into 2.6.x
Diffstat (limited to 'lib/puppet/parser/compiler.rb')
-rw-r--r--lib/puppet/parser/compiler.rb19
1 files changed, 8 insertions, 11 deletions
diff --git a/lib/puppet/parser/compiler.rb b/lib/puppet/parser/compiler.rb
index 6e8e3d26b..98bf3b574 100644
--- a/lib/puppet/parser/compiler.rb
+++ b/lib/puppet/parser/compiler.rb
@@ -56,23 +56,20 @@ class Puppet::Parser::Compiler
# Note that this will fail if the resource is not unique.
@catalog.add_resource(resource)
+ if resource.type.to_s.downcase != "class" && resource[:stage]
+ raise ArgumentError, "Only classes can set 'stage'; normal resources like #{resource} cannot change run stage"
+ end
- # Add our container edge. If we're a class, then we get treated specially - we can
- # control the stage that the class is applied in. Otherwise, we just
- # get added to our parent container.
+ # 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"
+ # This adds a resource to the class it lexically appears in in the
+ # manifest.
if resource.type.to_s.downcase != "class"
- raise ArgumentError, "Only classes can set 'stage'; normal resources like #{resource} cannot change run stage" if resource[:stage]
return @catalog.add_edge(scope.resource, resource)
end
-
- unless stage = @catalog.resource(:stage, resource[:stage] || (scope && scope.resource && scope.resource[:stage]) || :main)
- raise ArgumentError, "Could not find stage #{resource[:stage] || :main} specified by #{resource}"
- end
-
- resource[:stage] ||= stage.title unless stage.title == :main
- @catalog.add_edge(stage, resource)
end
# Do we use nodes found in the code, vs. the external node sources?