diff options
-rw-r--r-- | lib/puppet/ssl/host.rb | 9 | ||||
-rwxr-xr-x | spec/unit/application/secret_agent_spec.rb | 4 | ||||
-rwxr-xr-x | spec/unit/face/secret_agent_spec.rb | 4 | ||||
-rwxr-xr-x | spec/unit/indirector/ssl_file_spec.rb | 6 | ||||
-rwxr-xr-x | spec/unit/node/environment_spec.rb | 2 |
5 files changed, 16 insertions, 9 deletions
diff --git a/lib/puppet/ssl/host.rb b/lib/puppet/ssl/host.rb index 08a8ace1f..a06b1e275 100644 --- a/lib/puppet/ssl/host.rb +++ b/lib/puppet/ssl/host.rb @@ -27,10 +27,11 @@ class Puppet::SSL::Host attr_accessor :desired_state def self.localhost - @localhost ||= new.tap do |l| - l.generate unless l.certificate - l.key # Make sure it's read in - end + return @localhost if @localhost + @localhost = new + @localhost.generate unless @localhost.certificate + @localhost.key + @localhost end # This is the constant that people will use to mark that a given host is diff --git a/spec/unit/application/secret_agent_spec.rb b/spec/unit/application/secret_agent_spec.rb index eba936447..d3923406d 100755 --- a/spec/unit/application/secret_agent_spec.rb +++ b/spec/unit/application/secret_agent_spec.rb @@ -6,10 +6,12 @@ require 'puppet/indirector/report/rest' require 'tempfile' describe "Puppet::Application::Secret_agent" do + include PuppetSpec::Files + it "should retrieve and apply a catalog and submit a report" do pending "REVISIT: 2.7 changes broke this, and we want the merge published" - dirname = Dir.mktmpdir("puppetdir") + dirname = tmpdir("puppetdir") Puppet[:vardir] = dirname Puppet[:confdir] = dirname Puppet[:certname] = "foo" diff --git a/spec/unit/face/secret_agent_spec.rb b/spec/unit/face/secret_agent_spec.rb index a5ec01f27..2530d144d 100755 --- a/spec/unit/face/secret_agent_spec.rb +++ b/spec/unit/face/secret_agent_spec.rb @@ -5,10 +5,12 @@ require 'puppet/indirector/catalog/rest' require 'tempfile' describe Puppet::Face[:secret_agent, '0.0.1'] do + include PuppetSpec::Files + describe "#synchronize" do it "should retrieve and apply a catalog and return a report" do pending "This test doesn't work, but the code actually does - tested by LAK" - dirname = Dir.mktmpdir("puppetdir") + dirname = tmpdir("puppetdir") Puppet[:vardir] = dirname Puppet[:confdir] = dirname @catalog = Puppet::Resource::Catalog.new diff --git a/spec/unit/indirector/ssl_file_spec.rb b/spec/unit/indirector/ssl_file_spec.rb index e0e30bd9d..8ee19c8c8 100755 --- a/spec/unit/indirector/ssl_file_spec.rb +++ b/spec/unit/indirector/ssl_file_spec.rb @@ -19,7 +19,7 @@ describe Puppet::Indirector::SslFile do @setting = :certdir @file_class.store_in @setting - @path = make_absolute("/tmp/my_directory") + @path = make_absolute("/thisdoesntexist/my_directory") Puppet[:noop] = false Puppet[@setting] = @path Puppet[:trace] = false @@ -43,7 +43,9 @@ describe Puppet::Indirector::SslFile do it "should fail if no store directory or file location has been set" do @file_class.store_in nil @file_class.store_at nil - lambda { @file_class.new }.should raise_error(Puppet::DevError) + FileTest.expects(:exists?).with(File.dirname(@path)).at_least(0).returns(true) + Dir.stubs(:mkdir).with(@path) + lambda { @file_class.new }.should raise_error(Puppet::DevError, /No file or directory setting provided/) end describe "when managing ssl files" do diff --git a/spec/unit/node/environment_spec.rb b/spec/unit/node/environment_spec.rb index 79c21248d..78d383440 100755 --- a/spec/unit/node/environment_spec.rb +++ b/spec/unit/node/environment_spec.rb @@ -104,7 +104,7 @@ describe Puppet::Node::Environment do end it "should validate the modulepath directories" do - real_file = Dir.mktmpdir + real_file = tmpdir('moduledir') path = %W[/one /two #{real_file}].join(File::PATH_SEPARATOR) Puppet[:modulepath] = path |