Allowing the singleton_instance value to be expirable is unnecessary, because
there will never be a need for a different CA instance in the lifetime of a
master. Additionally, the master never expired its cache anyway. This was only
using the cacher so it could be expired for tests, so it can safely be removed.

Reviewed-By: Jacob Helwig <[email protected]>
---
 lib/puppet/ssl/certificate_authority.rb            |   12 +++++++-----
 spec/integration/ssl/certificate_authority_spec.rb |    2 --
 spec/unit/ssl/certificate_authority_spec.rb        |    4 ++--
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/lib/puppet/ssl/certificate_authority.rb 
b/lib/puppet/ssl/certificate_authority.rb
index d65067c..a4cbaf7 100644
--- a/lib/puppet/ssl/certificate_authority.rb
+++ b/lib/puppet/ssl/certificate_authority.rb
@@ -1,6 +1,6 @@
+require 'monitor'
 require 'puppet/ssl/host'
 require 'puppet/ssl/certificate_request'
-require 'puppet/util/cacher'
 
 # The class that knows how to sign certificates.  It creates
 # a 'special' SSL::Host whose name is 'ca', thus indicating
@@ -17,6 +17,8 @@ class Puppet::SSL::CertificateAuthority
   require 'puppet/ssl/certificate_authority/interface'
   require 'puppet/network/authstore'
 
+  extend MonitorMixin
+
   class CertificateVerificationError < RuntimeError
     attr_accessor :error_code
 
@@ -25,10 +27,10 @@ class Puppet::SSL::CertificateAuthority
     end
   end
 
-  class << self
-    include Puppet::Util::Cacher
-
-    cached_attr(:singleton_instance) { new }
+  def self.singleton_instance
+    synchronize do
+      @singleton_instance ||= new
+    end
   end
 
   def self.ca?
diff --git a/spec/integration/ssl/certificate_authority_spec.rb 
b/spec/integration/ssl/certificate_authority_spec.rb
index c6ff58e..68b2401 100755
--- a/spec/integration/ssl/certificate_authority_spec.rb
+++ b/spec/integration/ssl/certificate_authority_spec.rb
@@ -29,8 +29,6 @@ describe Puppet::SSL::CertificateAuthority, :fails_on_windows 
=> true do
     system("rm -rf #{@dir}")
     Puppet.settings.clear
 
-    Puppet::Util::Cacher.expire
-
     Puppet::SSL::CertificateAuthority.instance_variable_set("@instance", nil)
   }
 
diff --git a/spec/unit/ssl/certificate_authority_spec.rb 
b/spec/unit/ssl/certificate_authority_spec.rb
index 3aedfdc..3c5780a 100755
--- a/spec/unit/ssl/certificate_authority_spec.rb
+++ b/spec/unit/ssl/certificate_authority_spec.rb
@@ -5,7 +5,7 @@ require 'puppet/ssl/certificate_authority'
 
 describe Puppet::SSL::CertificateAuthority do
   after do
-    Puppet::Util::Cacher.expire
+    
Puppet::SSL::CertificateAuthority.instance_variable_set(:@singleton_instance, 
nil)
     Puppet.settings.clearused
   end
 
@@ -25,7 +25,7 @@ describe Puppet::SSL::CertificateAuthority do
   describe "when finding an existing instance" do
     describe "and the host is a CA host and the run_mode is master" do
       before do
-        Puppet.settings.stubs(:value).with(:ca).returns true
+        Puppet[:ca] = true
         Puppet.run_mode.stubs(:master?).returns true
 
         @ca = mock('ca')
-- 
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