Previously, indirections were storing their termini in a cached_attr, so that
they could be easily cleared for tests. Because this provides no value outside
of testing, we instead simply create an attr_reader for termini, and expire
them manually in tests.

Reviewed-By: Jacob Helwig <[email protected]>
---
 lib/puppet/indirector/indirection.rb               |    8 +++-----
 spec/integration/ssl/certificate_request_spec.rb   |    6 +++---
 .../ssl/certificate_revocation_list_spec.rb        |    2 +-
 3 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/lib/puppet/indirector/indirection.rb 
b/lib/puppet/indirector/indirection.rb
index d958a82..20b260b 100644
--- a/lib/puppet/indirector/indirection.rb
+++ b/lib/puppet/indirector/indirection.rb
@@ -1,13 +1,11 @@
 require 'puppet/util/docs'
 require 'puppet/indirector/envelope'
 require 'puppet/indirector/request'
-require 'puppet/util/cacher'
 
 # The class that connects functional classes with their different collection
 # back-ends.  Each indirection has a set of associated terminus classes,
 # each of which is a subclass of Puppet::Indirector::Terminus.
 class Puppet::Indirector::Indirection
-  include Puppet::Util::Cacher
   include Puppet::Util::Docs
 
   @@indirections = []
@@ -33,6 +31,8 @@ class Puppet::Indirector::Indirection
 
   attr_accessor :name, :model
 
+  attr_reader :termini
+
   # Create and return our cache terminus.
   def cache
     raise(Puppet::DevError, "Tried to cache when no cache class was set") 
unless cache_class
@@ -88,6 +88,7 @@ class Puppet::Indirector::Indirection
   def initialize(model, name, options = {})
     @model = model
     @name = name
+    @termini = {}
 
     @cache_class = nil
     @terminus_class = nil
@@ -313,7 +314,4 @@ class Puppet::Indirector::Indirection
     end
     klass.new
   end
-
-  # Cache our terminus instances indefinitely, but make it easy to clean them 
up.
-  cached_attr(:termini) { Hash.new }
 end
diff --git a/spec/integration/ssl/certificate_request_spec.rb 
b/spec/integration/ssl/certificate_request_spec.rb
index 31bb48d..07a4d92 100755
--- a/spec/integration/ssl/certificate_request_spec.rb
+++ b/spec/integration/ssl/certificate_request_spec.rb
@@ -28,14 +28,14 @@ describe Puppet::SSL::CertificateRequest, :fails_on_windows 
=> true do
     @csr = Puppet::SSL::CertificateRequest.new("luke.madstop.com")
 
     @key = OpenSSL::PKey::RSA.new(512)
+
+    # This is necessary so the terminus instances don't lie around.
+    Puppet::SSL::CertificateRequest.indirection.termini.clear
   end
 
   after do
     system("rm -rf #{@dir}")
     Puppet.settings.clear
-
-    # This is necessary so the terminus instances don't lie around.
-    Puppet::Util::Cacher.expire
   end
 
   it "should be able to generate CSRs" do
diff --git a/spec/integration/ssl/certificate_revocation_list_spec.rb 
b/spec/integration/ssl/certificate_revocation_list_spec.rb
index 95f0e63..5d2b102 100755
--- a/spec/integration/ssl/certificate_revocation_list_spec.rb
+++ b/spec/integration/ssl/certificate_revocation_list_spec.rb
@@ -29,7 +29,7 @@ describe Puppet::SSL::CertificateRevocationList, 
:fails_on_windows => true do
     Puppet.settings.clear
 
     # This is necessary so the terminus instances don't lie around.
-    Puppet::Util::Cacher.expire
+    Puppet::SSL::Host.indirection.termini.clear
   }
 
   it "should be able to read in written out CRLs with no revoked certificates" 
do
-- 
1.7.5.4

-- 
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