diff options
| author | Markus Roberts <Markus@reality.com> | 2010-08-15 18:56:26 -0700 |
|---|---|---|
| committer | Markus Roberts <Markus@reality.com> | 2010-08-21 13:07:24 -0700 |
| commit | 20f4b903acd91074778f379631cf7545fdff9eb8 (patch) | |
| tree | 8f161d475108f721d5341322885d53561e8cb87a | |
| parent | 57bb06b557c74e227cb0f9799e698aecf90ea9a4 (diff) | |
| download | puppet-20f4b903acd91074778f379631cf7545fdff9eb8.tar.gz puppet-20f4b903acd91074778f379631cf7545fdff9eb8.tar.xz puppet-20f4b903acd91074778f379631cf7545fdff9eb8.zip | |
Fix for #4518 -- classes not getting added to compiler.classes
The responsibility for adding classes to the compiler's classes list (for use
in constructing classes.txt) moved around a bit in the 0.25 to 2.6 transition
before being dropped in a merge conflict resolution. Ooops. This restores it,
and adds tests to prevent regression.
| -rw-r--r-- | lib/puppet/resource/type.rb | 1 | ||||
| -rwxr-xr-x | spec/unit/resource/type_spec.rb | 17 |
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/puppet/resource/type.rb b/lib/puppet/resource/type.rb index 6296d26e5..f6d378512 100644 --- a/lib/puppet/resource/type.rb +++ b/lib/puppet/resource/type.rb @@ -69,6 +69,7 @@ class Puppet::Resource::Type end scope = subscope(scope, resource) unless resource.title == :main + scope.compiler.add_class(name) unless definition? set_resource_parameters(resource, scope) diff --git a/spec/unit/resource/type_spec.rb b/spec/unit/resource/type_spec.rb index 4d3942c5c..f58092ec5 100755 --- a/spec/unit/resource/type_spec.rb +++ b/spec/unit/resource/type_spec.rb @@ -412,6 +412,23 @@ describe Puppet::Resource::Type do @type = Puppet::Resource::Type.new(:hostclass, "foo") end + it "should add hostclass names to the classes list" do + @type.evaluate_code(@resource) + @compiler.catalog.classes.should be_include("foo") + end + + it "should add node names to the classes list" do + @type = Puppet::Resource::Type.new(:node, "foo") + @type.evaluate_code(@resource) + @compiler.catalog.classes.should be_include("foo") + end + + it "should not add defined resource names to the classes list" do + @type = Puppet::Resource::Type.new(:definition, "foo") + @type.evaluate_code(@resource) + @compiler.catalog.classes.should_not be_include("foo") + end + it "should set all of its parameters in a subscope" do subscope = stub 'subscope', :compiler => @compiler @type.expects(:subscope).with(@scope, @resource).returns subscope |
