summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-01-23 16:56:14 -0600
committerLuke Kanies <luke@madstop.com>2009-02-06 18:08:41 -0600
commit212b3e3dff7cb8846e0d09d39faf226b60c62e6b (patch)
tree83ea695dae7d3a6c74c1a3a1df84b36ff7616e90
parent5a835315c203e6951562c098a99c4276ed60a17e (diff)
downloadpuppet-212b3e3dff7cb8846e0d09d39faf226b60c62e6b.tar.gz
puppet-212b3e3dff7cb8846e0d09d39faf226b60c62e6b.tar.xz
puppet-212b3e3dff7cb8846e0d09d39faf226b60c62e6b.zip
Allowing the Indirection cache to be reset to nil
Otherwise we couldn't disable a cache once configured. Signed-off-by: Luke Kanies <luke@madstop.com>
-rw-r--r--lib/puppet/indirector/indirection.rb2
-rwxr-xr-xspec/unit/indirector/indirection.rb5
2 files changed, 4 insertions, 3 deletions
diff --git a/lib/puppet/indirector/indirection.rb b/lib/puppet/indirector/indirection.rb
index c560bb5b7..2eac2395b 100644
--- a/lib/puppet/indirector/indirection.rb
+++ b/lib/puppet/indirector/indirection.rb
@@ -47,7 +47,7 @@ class Puppet::Indirector::Indirection
attr_reader :cache_class
# Define a terminus class to be used for caching.
def cache_class=(class_name)
- validate_terminus_class(class_name)
+ validate_terminus_class(class_name) if class_name
@cache_class = class_name
end
diff --git a/spec/unit/indirector/indirection.rb b/spec/unit/indirector/indirection.rb
index 71dc4d24f..51bd45473 100755
--- a/spec/unit/indirector/indirection.rb
+++ b/spec/unit/indirector/indirection.rb
@@ -690,8 +690,9 @@ describe Puppet::Indirector::Indirection do
proc { @indirection.cache_class = "" }.should raise_error(ArgumentError)
end
- it "should fail to set the cache class when the cache class name is nil" do
- proc { @indirection.cache_class = nil }.should raise_error(ArgumentError)
+ it "should allow resetting the cache_class to nil" do
+ @indirection.cache_class = nil
+ @indirection.cache_class.should be_nil
end
it "should fail to set the cache class when the specified cache class cannot be found" do