diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2005-08-29 22:53:44 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2005-08-29 22:53:44 +0000 |
| commit | 8a99636cb9f048bfbbd8b956a15ec84ae68d34f0 (patch) | |
| tree | 6982c84d50c3e195d2cf76286a4112a8d4767533 /bin/puppetd | |
| parent | f65563d3d6eddeeac5f1b14e7b2635776be802a7 (diff) | |
| download | puppet-8a99636cb9f048bfbbd8b956a15ec84ae68d34f0.tar.gz puppet-8a99636cb9f048bfbbd8b956a15ec84ae68d34f0.tar.xz puppet-8a99636cb9f048bfbbd8b956a15ec84ae68d34f0.zip | |
adding a "--noop" option along with a test case for it
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@607 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'bin/puppetd')
| -rwxr-xr-x | bin/puppetd | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/bin/puppetd b/bin/puppetd index 7b757093e..0579002b2 100755 --- a/bin/puppetd +++ b/bin/puppetd @@ -11,6 +11,7 @@ # puppetd [-h|--help] [-V|--version] [-d|--debug] [-v|--verbose] # [--ssldir <cert directory>] [-l|--logdest <syslog|<file>|console>] # [--fqdn <host name>] [-p|--port <port>] [-s|--server <server>] +# [-w|--waitforcert <seconds>] # # = Description # @@ -48,7 +49,7 @@ # # server:: # The remote server from whom to receive the local configuration. Currently -# must also be the certificate authority. Currently defaults to 'localhost'. +# must also be the certificate authority. Currently defaults to 'puppet'. # # ssldir:: # Where to store and find certificates. Defaults to /etc/puppet/ssl. @@ -59,6 +60,10 @@ # version:: # Print the puppet version number and exit. # +# waitforcert:: +# Have the process wait around, continuously retrying for the certificate +# each <argument> seconds. +# # = Example # # puppet -s puppet.domain.com @@ -90,17 +95,21 @@ result = GetoptLong.new( [ "--fqdn", "-f", GetoptLong::REQUIRED_ARGUMENT ], [ "--help", "-h", GetoptLong::NO_ARGUMENT ], [ "--logdest", "-l", GetoptLong::REQUIRED_ARGUMENT ], + [ "--noop", "-n", GetoptLong::NO_ARGUMENT ], [ "--port", "-p", GetoptLong::REQUIRED_ARGUMENT ], [ "--server", "-s", GetoptLong::REQUIRED_ARGUMENT ], [ "--ssldir", GetoptLong::REQUIRED_ARGUMENT ], [ "--verbose", "-v", GetoptLong::NO_ARGUMENT ], - [ "--version", "-V", GetoptLong::NO_ARGUMENT ] + [ "--version", "-V", GetoptLong::NO_ARGUMENT ], + [ "--waitforcert", "-w", GetoptLong::REQUIRED_ARGUMENT ] ) -server = "localhost" +server = "puppet" fqdn = nil args = {} +waitforcert = false + begin result.each { |opt,arg| case opt @@ -118,6 +127,8 @@ begin Puppet[:loglevel] = :info when "--debug" Puppet[:loglevel] = :debug + when "--noop" + Puppet[:noop] = true when "--ssldir" Puppet[:ssldir] = arg when "--fqdn" @@ -134,6 +145,8 @@ begin else $stderr.puts "Invalid log destination %s" % arg end + when "--waitforcert" + waitforcert = arg end } rescue GetoptLong::InvalidOption => detail @@ -159,14 +172,21 @@ end client = Puppet::Client::MasterClient.new(args) unless client.readcert - begin - while ! client.requestcert do - Puppet.notice "Did not receive certificate" - sleep 60 + if waitforcert + begin + while ! client.requestcert do + Puppet.notice "Did not receive certificate" + sleep waitforcert + end + rescue => detail + Puppet.err "Could not request certificate: %s" % detail.to_s + exit(23) + end + else + unless client.requestcert + Puppet.notice "No certificates; exiting" + exit(1) end - rescue => detail - Puppet.err "Could not request certificate: %s" % detail.to_s - exit(23) end end |
