summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-04-26 17:32:36 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-04-26 17:32:36 +0000
commita78bf1ee71dd3a0930ad5f7277f7c50dc66fa55d (patch)
tree7a9582be8f87d35d21f7a735b0425f7e3cc17dd1 /bin
parentbda8e52a02d77c39cd96ea02352c0067a57135e7 (diff)
downloadpuppet-a78bf1ee71dd3a0930ad5f7277f7c50dc66fa55d.tar.gz
adding "clean" mode to puppetca
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1140 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'bin')
-rwxr-xr-xbin/puppetca29
1 files changed, 20 insertions, 9 deletions
diff --git a/bin/puppetca b/bin/puppetca
index 8bc7ac1ae..2cbb37872 100755
--- a/bin/puppetca
+++ b/bin/puppetca
@@ -10,6 +10,7 @@
#
# puppetca [-h|--help] [-V|--version] [-d|--debug] [-v|--verbose]
# [-g|--generate] [-l|--list] [-s|--sign]
+# [-c|--clean] [host]
#
# = Description
#
@@ -29,6 +30,9 @@
# all::
# Operate on all outstanding requests. Only makes sense with '--sign'.
#
+# clean::
+# Remove all traces of a host. This is useful when rebuilding hosts.
+#
# debug::
# Enable full debugging.
#
@@ -78,6 +82,7 @@ end
options = [
[ "--all", "-a", GetoptLong::NO_ARGUMENT ],
+ [ "--clean", "-c", GetoptLong::NO_ARGUMENT ],
[ "--debug", "-d", GetoptLong::NO_ARGUMENT ],
[ "--generate", "-g", GetoptLong::NO_ARGUMENT ],
[ "--help", "-h", GetoptLong::NO_ARGUMENT ],
@@ -100,6 +105,8 @@ begin
case opt
when "--all"
all = true
+ when "--clean"
+ mode = :clean
when "--debug"
Puppet::Log.level = :debug
when "--generate"
@@ -150,15 +157,23 @@ unless mode
exit(12)
end
-hosts = ca.list
-unless hosts.length > 0 or mode == :generate
- Puppet.info "No waiting requests"
- exit(0)
+if mode == :generate or mode == :clean
+ hosts = ARGV
+else
+ hosts = ca.list
+ unless hosts.length > 0
+ puts "No certificates to sign"
+ exit(0)
+ end
end
case mode
when :list
puts hosts.join("\n")
+when :clean
+ hosts.each do |host|
+ ca.clean(host)
+ end
when :sign
unless ARGV.length > 0 or all
$stderr.puts(
@@ -200,11 +215,7 @@ when :sign
}
when :generate
# we need to generate a certificate for a host
- unless ARGV.length > 0
- $stderr.puts "You must specify hosts to generate certs for"
- exit(84)
- end
- ARGV.each { |host|
+ hosts.each { |host|
puts "Generating certificate for %s" % host
cert = Puppet::SSLCertificates::Certificate.new(
:name => host