diff options
| author | Luke Kanies <luke@madstop.com> | 2007-10-03 17:50:50 -0500 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2007-10-03 17:50:50 -0500 |
| commit | d4afe39fa1aeb4f4e9d1bcdaf0f924aac2f00584 (patch) | |
| tree | 5b4da4d790618182e4370be7118b835daa2304b0 | |
| parent | f8c8efeff6f08cf8c23075311ce14bfd4decedb0 (diff) | |
| download | puppet-d4afe39fa1aeb4f4e9d1bcdaf0f924aac2f00584.tar.gz puppet-d4afe39fa1aeb4f4e9d1bcdaf0f924aac2f00584.tar.xz puppet-d4afe39fa1aeb4f4e9d1bcdaf0f924aac2f00584.zip | |
Fixing #813 -- empty configurations again work.
| -rw-r--r-- | lib/puppet/node/configuration.rb | 5 | ||||
| -rwxr-xr-x | spec/unit/node/configuration.rb | 17 |
2 files changed, 20 insertions, 2 deletions
diff --git a/lib/puppet/node/configuration.rb b/lib/puppet/node/configuration.rb index 53f63d003..3571eecda 100644 --- a/lib/puppet/node/configuration.rb +++ b/lib/puppet/node/configuration.rb @@ -226,9 +226,10 @@ class Puppet::Node::Configuration < Puppet::PGraph raise Puppet::DevError, "Could not find 'main' class; cannot generate configuration" end - # Retrive the bucket for the top-level scope and set the appropriate metadata. + # Retrieve the bucket for the top-level scope and set the appropriate metadata. unless result = buckets[main.to_s] - raise Puppet::DevError, "Did not evaluate top scope" + # This only happens when the configuration is entirely empty. + result = buckets[main.to_s] = main.to_trans end result.classes = classes diff --git a/spec/unit/node/configuration.rb b/spec/unit/node/configuration.rb index 8ba55f50c..6893c8581 100755 --- a/spec/unit/node/configuration.rb +++ b/spec/unit/node/configuration.rb @@ -68,6 +68,23 @@ describe Puppet::Node::Configuration, " when extracting transobjects" do Puppet::Parser::Resource.new(:type => type, :title => name, :source => @source, :scope => @scope) end + it "should always create a TransBucket for the 'main' class" do + config = Puppet::Node::Configuration.new("mynode") + + @scope = mkscope + @source = mock 'source' + + main = mkresource("class", :main) + config.add_vertex!(main) + + bucket = mock 'bucket' + bucket.expects(:classes=).with(config.classes) + main.stubs(:builtin?).returns(false) + main.expects(:to_transbucket).returns(bucket) + + config.extract_to_transportable.should equal(bucket) + end + # This isn't really a spec-style test, but I don't know how better to do it. it "should transform the resource graph into a tree of TransBuckets and TransObjects" do config = Puppet::Node::Configuration.new("mynode") |
