Update puppetlabs/stdlib module
[mirror/dsa-puppet.git] / 3rdparty / modules / stdlib / lib / puppet / parser / functions / validate_x509_rsa_key_pair.rb
index fc9f23f..ea69dc4 100644 (file)
@@ -1,6 +1,8 @@
+#
+# validate_x509_rsa_key_pair.rb
+#
 module Puppet::Parser::Functions
-
-  newfunction(:validate_x509_rsa_key_pair, :doc => <<-ENDHEREDOC
+  newfunction(:validate_x509_rsa_key_pair, :doc => <<-DOC
     Validates a PEM-formatted X.509 certificate and RSA private key using
     OpenSSL. Verifies that the certficate's signature was created from the
     supplied key.
@@ -9,16 +11,16 @@ module Puppet::Parser::Functions
 
     validate_x509_rsa_key_pair($cert, $key)
 
-    ENDHEREDOC
-  ) do |args|
+    DOC
+             ) do |args|
 
     require 'openssl'
 
     NUM_ARGS = 2 unless defined? NUM_ARGS
 
-    unless args.length == NUM_ARGS then
+    unless args.length == NUM_ARGS
       raise Puppet::ParseError,
-        ("validate_x509_rsa_key_pair(): wrong number of arguments (#{args.length}; must be #{NUM_ARGS})")
+            "validate_x509_rsa_key_pair(): wrong number of arguments (#{args.length}; must be #{NUM_ARGS})"
     end
 
     args.each do |arg|
@@ -40,8 +42,7 @@ module Puppet::Parser::Functions
     end
 
     unless cert.verify(key)
-      raise Puppet::ParseError, "Certificate signature does not match supplied key"
+      raise Puppet::ParseError, 'Certificate signature does not match supplied key'
     end
   end
-
 end