Please review pull request #678: (#13957) Allow to revoke certificates by specifying its serial number opened by (asquelt)

Description:

  • Opened: Tue Apr 17 18:55:23 UTC 2012
  • Based on: puppetlabs:master (7e22550553515cc90ae94c5e7c847f15c0313119)
  • Requested merge: asquelt:master (aa7ef0e8fa35d6ad82f86c0dab41b04f5d6415a0)

Diff follows:

diff --git a/lib/puppet/ssl/certificate_authority.rb b/lib/puppet/ssl/certificate_authority.rb
index 179acd9..e2d8646 100644
--- a/lib/puppet/ssl/certificate_authority.rb
+++ b/lib/puppet/ssl/certificate_authority.rb
@@ -229,10 +229,16 @@ def print(name)
   def revoke(name)
     raise ArgumentError, "Cannot revoke certificates when the CRL is disabled" unless crl
 
-    if cert = Puppet::SSL::Certificate.indirection.find(name)
-      serial = cert.content.serial
-    elsif ! serial = inventory.serial(name)
-      raise ArgumentError, "Could not find a serial number for #{name}"
+    if name =~ /^(0x[0-9a-f]+)$/
+      serial = $1.to_i(16)
+    elsif name =~ /^(\d+)$/
+      serial = $1.to_i(10)
+    else
+      if cert = Puppet::SSL::Certificate.indirection.find(name)
+        serial = cert.content.serial
+      elsif ! serial = inventory.serial(name)
+        raise ArgumentError, "Could not find a serial number for #{name}"
+      end
     end
     crl.revoke(serial, host.key.content)
   end

    

--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to