[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35

test branch puppet-dev at googlegroups.com
Wed Jul 14 10:34:39 UTC 2010


The following commit has been merged in the upstream branch:
commit 58cf8d9dcbef783e280782d56febf06822e3e4eb
Author: Luke Kanies <luke at puppetlabs.com>
Date:   Fri Jun 11 09:47:57 2010 -0700

    Working #3139 - Catalogs default to host_config
    
    The whole host_config concept is a bit outdated now that Configurer
    exists, I think, (since any catalog it uses should be a host_config).
    However, fixing that is outside of the scope of this series.
    
    In the meantime, this does a better job of making sure every
    catalog except the Settings catalogs are host_configs.
    
    Signed-off-by: Luke Kanies <luke at puppetlabs.com>

diff --git a/lib/puppet/application/apply.rb b/lib/puppet/application/apply.rb
index 39bcd26..19346da 100644
--- a/lib/puppet/application/apply.rb
+++ b/lib/puppet/application/apply.rb
@@ -116,8 +116,6 @@ class Puppet::Application::Apply < Puppet::Application
             # Translate it to a RAL catalog
             catalog = catalog.to_ral
 
-            catalog.host_config = true if Puppet[:graph] or Puppet[:report]
-
             catalog.finalize
 
             catalog.retrieval_duration = Time.now - starttime
diff --git a/lib/puppet/configurer.rb b/lib/puppet/configurer.rb
index f546117..9e1fa09 100644
--- a/lib/puppet/configurer.rb
+++ b/lib/puppet/configurer.rb
@@ -122,7 +122,6 @@ class Puppet::Configurer
         catalog = result.to_ral
         catalog.finalize
         catalog.retrieval_duration = duration
-        catalog.host_config = true
         catalog.write_class_file
         return catalog
     end
diff --git a/lib/puppet/resource/catalog.rb b/lib/puppet/resource/catalog.rb
index b00b6f4..3cd4d7a 100644
--- a/lib/puppet/resource/catalog.rb
+++ b/lib/puppet/resource/catalog.rb
@@ -273,7 +273,7 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
     end
 
     def host_config?
-        host_config || false
+        host_config
     end
 
     def initialize(name = nil)
@@ -285,6 +285,8 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
         @applying = false
         @relationship_graph = nil
 
+        @host_config = true
+
         @aliases = {}
 
         if block_given?
diff --git a/spec/unit/configurer.rb b/spec/unit/configurer.rb
index 2bdb63d..377ac74 100755
--- a/spec/unit/configurer.rb
+++ b/spec/unit/configurer.rb
@@ -147,28 +147,25 @@ describe Puppet::Configurer, "when executing a catalog run" do
     end
 
     it "should apply the catalog with all options to :run" do
-        catalog = stub 'catalog', :retrieval_duration= => nil
-        @agent.expects(:retrieve_catalog).returns catalog
+        @agent.expects(:retrieve_catalog).returns @catalog
 
-        catalog.expects(:apply).with { |args| args[:one] == true }
+        @catalog.expects(:apply).with { |args| args[:one] == true }
         @agent.run :one => true
     end
 
     it "should accept a catalog and use it instead of retrieving a different one" do
-        catalog = stub 'catalog', :retrieval_duration= => nil
         @agent.expects(:retrieve_catalog).never
 
-        catalog.expects(:apply)
-        @agent.run :one => true, :catalog => catalog
+        @catalog.expects(:apply)
+        @agent.run :one => true, :catalog => @catalog
     end
 
     it "should benchmark how long it takes to apply the catalog" do
         @agent.expects(:benchmark).with(:notice, "Finished catalog run")
 
-        catalog = stub 'catalog', :retrieval_duration= => nil
-        @agent.expects(:retrieve_catalog).returns catalog
+        @agent.expects(:retrieve_catalog).returns @catalog
 
-        catalog.expects(:apply).never # because we're not yielding
+        @catalog.expects(:apply).never # because we're not yielding
         @agent.run
     end
 
@@ -190,14 +187,12 @@ describe Puppet::Configurer, "when executing a catalog run" do
         report = stub 'report'
         @agent.expects(:initialize_report).returns report
 
-        catalog = stub 'catalog', :retrieval_duration= => nil
-
         trans = stub 'transaction'
-        catalog.expects(:apply).returns trans
+        @catalog.expects(:apply).returns trans
 
         @agent.expects(:send_report).with { |r, t| t == trans }
 
-        @agent.run :catalog => catalog
+        @agent.run :catalog => @catalog
     end
 
     it "should send the transaction report even if the catalog could not be retrieved" do
@@ -461,12 +456,6 @@ describe Puppet::Configurer, "when converting the catalog" do
 
         @agent.convert_catalog(@oldcatalog, 10)
     end
-
-    it "should mark the RAL catalog as a host catalog" do
-        @catalog.expects(:host_config=).with true
-
-        @agent.convert_catalog(@oldcatalog, 10)
-    end
 end
 
 describe Puppet::Configurer, "when preparing for a run" do
diff --git a/spec/unit/resource/catalog.rb b/spec/unit/resource/catalog.rb
index bd241fd..e633b13 100755
--- a/spec/unit/resource/catalog.rb
+++ b/spec/unit/resource/catalog.rb
@@ -628,8 +628,13 @@ describe Puppet::Resource::Catalog, "when compiling" do
             end
         end
 
-        it "should default to not being a host catalog" do
-            @catalog.host_config.should be_nil
+        it "should default to being a host catalog" do
+            @catalog.host_config.should be_true
+        end
+
+        it "should be able to be set to a non-host_config" do
+            @catalog.host_config = false
+            @catalog.host_config.should be_false
         end
 
         it "should pass supplied tags on to the transaction" do

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list