summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-06-14 21:32:10 -0500
committerLuke Kanies <luke@madstop.com>2008-06-14 21:32:10 -0500
commit7b10c39bdc20cad3d4652008c404d576461d75e1 (patch)
treedcc2be944f00b40ad213ba254c712f2677522391 /lib/puppet
parent6a61198f9293674a4bf0aa75bfbca10e20f64d20 (diff)
parent575f37a0656f5a1f94fe6fb1b189d1701a98cadc (diff)
downloadpuppet-7b10c39bdc20cad3d4652008c404d576461d75e1.tar.gz
puppet-7b10c39bdc20cad3d4652008c404d576461d75e1.tar.xz
puppet-7b10c39bdc20cad3d4652008c404d576461d75e1.zip
Merge branch '0.24.x'
Conflicts: lib/puppet/executables/client/certhandler.rb spec/unit/executables/client/certhandler.rb
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/executables/client/certhandler.rb15
-rw-r--r--lib/puppet/parser/interpreter.rb19
2 files changed, 13 insertions, 21 deletions
diff --git a/lib/puppet/executables/client/certhandler.rb b/lib/puppet/executables/client/certhandler.rb
index 6f23de0e3..b73642941 100644
--- a/lib/puppet/executables/client/certhandler.rb
+++ b/lib/puppet/executables/client/certhandler.rb
@@ -4,8 +4,7 @@ module Puppet
module Client
class CertHandler
attr_writer :wait_for_cert, :one_time
-
- attr_reader :caclient
+ attr_reader :caclient, :new_cert
def initialize(wait_time, is_one_time)
@wait_for_cert = wait_time
@@ -14,7 +13,14 @@ module Puppet
@caclient = Puppet::Network::Client.ca.new()
end
+
+ # Did we just read a cert?
+ def new_cert?
+ new_cert
+ end
+ # Read, or retrieve if necessary, our certificate. Returns true if we retrieved
+ # a new cert, false if the cert already exists.
def read_retrieve
#NOTE: ACS this is checking that a file exists, maybe next time just do that?
unless read_cert
@@ -23,7 +29,7 @@ module Puppet
retrieve_cert
end
- !@new_cert
+ ! new_cert?
end
def retrieve_cert
@@ -54,7 +60,8 @@ module Puppet
def read_new_cert
if caclient.read_cert
# If we read it in, then we need to get rid of our existing http connection.
- # The @new_cert flag will help us do that
+ # The @new_cert flag will help us do that, in that it provides a way
+ # to notify that the cert status has changed.
@new_cert = true
Puppet.notice "Got signed certificate"
else
diff --git a/lib/puppet/parser/interpreter.rb b/lib/puppet/parser/interpreter.rb
index 04ca41494..423c34a4e 100644
--- a/lib/puppet/parser/interpreter.rb
+++ b/lib/puppet/parser/interpreter.rb
@@ -50,23 +50,8 @@ class Puppet::Parser::Interpreter
# Return the parser for a specific environment.
def parser(environment)
if ! @parsers[environment] or @parsers[environment].reparse?
- # This will throw an exception if it does not succeed. We only
- # want to get rid of the old parser if we successfully create a new
- # one.
- begin
- tmp = create_parser(environment)
- @parsers[environment].clear if @parsers[environment]
- @parsers[environment] = tmp
- rescue => detail
- # If a parser already exists, than assume that we logged the
- # exception elsewhere and reuse the parser. If one doesn't
- # exist, then reraise.
- if @parsers[environment]
- Puppet.err(detail.to_s + "; using previously parsed manifests")
- else
- raise detail
- end
- end
+ # This will throw an exception if it does not succeed.
+ @parsers[environment] = create_parser(environment)
end
@parsers[environment]
end