summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/puppet/executables/client/certhandler.rb7
-rwxr-xr-xspec/unit/executables/client/certhandler.rb13
2 files changed, 19 insertions, 1 deletions
diff --git a/lib/puppet/executables/client/certhandler.rb b/lib/puppet/executables/client/certhandler.rb
index b041397ae..bf3ea167d 100644
--- a/lib/puppet/executables/client/certhandler.rb
+++ b/lib/puppet/executables/client/certhandler.rb
@@ -49,7 +49,12 @@ module Puppet
exit(23) if @one_time
end
- sleep @wait_for_cert
+ if @wait_for_cert > 0
+ sleep @wait_for_cert
+ else
+ Puppet.notice "waitforcert disabled; exiting with no certificate"
+ exit(1)
+ end
end
end
diff --git a/spec/unit/executables/client/certhandler.rb b/spec/unit/executables/client/certhandler.rb
index 4f8f8139c..69d6de92b 100755
--- a/spec/unit/executables/client/certhandler.rb
+++ b/spec/unit/executables/client/certhandler.rb
@@ -91,6 +91,19 @@ describe cert_handler, "when handling certificates" do
end
end
+ describe "when waitforcert is disabled" do
+ before do
+ @handler = cert_handler.new(0, false)
+ @handler.stubs(:read_cert).returns false
+ end
+
+ it "should exit if the cert request does not return a certificate" do
+ @caclient.stubs(:request_cert).returns(false)
+ @handler.expects(:exit).with(1).raises(SystemExit)
+ lambda { @handler.retrieve_cert }.should raise_error(SystemExit)
+ end
+ end
+
describe "when in one time mode" do
before do
#true puts us in onetime mode