From: John A. Barbuto <[email protected]>

Signed-off-by: James Turnbull <[email protected]>
---
 lib/puppet/configurer.rb |    5 +++++
 spec/unit/configurer.rb  |   10 ++++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/lib/puppet/configurer.rb b/lib/puppet/configurer.rb
index 81845f5..efda545 100644
--- a/lib/puppet/configurer.rb
+++ b/lib/puppet/configurer.rb
@@ -99,6 +99,11 @@ class Puppet::Configurer
         end
 
         unless result
+            if ! Puppet[:usecacheonfailure]
+                Puppet.warning "Not using cache on failed catalog"
+                return nil
+            end
+
             begin
                 duration = thinmark do
                     result = catalog_class.find(name, 
fact_options.merge(:ignore_terminus => true))
diff --git a/spec/unit/configurer.rb b/spec/unit/configurer.rb
index 85bdb9d..0490967 100755
--- a/spec/unit/configurer.rb
+++ b/spec/unit/configurer.rb
@@ -137,6 +137,16 @@ describe Puppet::Configurer, "when retrieving a catalog" do
         @agent.retrieve_catalog.should == @catalog
     end
 
+    it "should log and return nil if no catalog can be retrieved from the 
server and :usecacheonfailure is disabled" do
+        Puppet.stubs(:[])
+        Puppet.expects(:[]).with(:usecacheonfailure).returns false
+        Puppet::Resource::Catalog.expects(:find).with { |name, options| 
options[:ignore_cache] == true }.returns nil
+
+        Puppet.expects(:warning)
+
+        @agent.retrieve_catalog.should be_nil
+    end
+
     it "should return nil if no cached catalog is available and no catalog can 
be retrieved from the server" do
         Puppet::Resource::Catalog.expects(:find).with { |name, options| 
options[:ignore_cache] == true }.returns nil
         Puppet::Resource::Catalog.expects(:find).with { |name, options| 
options[:ignore_terminus] == true }.returns nil
-- 
1.6.0.6


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to