summaryrefslogtreecommitdiffstats
path: root/lib/puppet/ssl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/ssl')
-rw-r--r--lib/puppet/ssl/base.rb4
-rw-r--r--lib/puppet/ssl/certificate_authority.rb16
-rw-r--r--lib/puppet/ssl/certificate_authority/interface.rb12
-rw-r--r--lib/puppet/ssl/certificate_factory.rb2
-rw-r--r--lib/puppet/ssl/certificate_request.rb4
-rw-r--r--lib/puppet/ssl/certificate_revocation_list.rb2
-rw-r--r--lib/puppet/ssl/host.rb6
-rw-r--r--lib/puppet/ssl/key.rb2
8 files changed, 24 insertions, 24 deletions
diff --git a/lib/puppet/ssl/base.rb b/lib/puppet/ssl/base.rb
index 7452a513d..745d733dc 100644
--- a/lib/puppet/ssl/base.rb
+++ b/lib/puppet/ssl/base.rb
@@ -18,7 +18,7 @@ class Puppet::SSL::Base
end
def self.wrapped_class
- raise(Puppet::DevError, "%s has not declared what class it wraps" % self) unless defined?(@wrapped_class)
+ raise(Puppet::DevError, "#{self} has not declared what class it wraps") unless defined?(@wrapped_class)
@wrapped_class
end
@@ -30,7 +30,7 @@ class Puppet::SSL::Base
end
def generate
- raise Puppet::DevError, "%s did not override 'generate'" % self.class
+ raise Puppet::DevError, "#{self.class} did not override 'generate'"
end
def initialize(name)
diff --git a/lib/puppet/ssl/certificate_authority.rb b/lib/puppet/ssl/certificate_authority.rb
index aa1ccf936..b66725cbf 100644
--- a/lib/puppet/ssl/certificate_authority.rb
+++ b/lib/puppet/ssl/certificate_authority.rb
@@ -78,7 +78,7 @@ class Puppet::SSL::CertificateAuthority
return false if ['false', false].include?(auto)
return true if ['true', true].include?(auto)
- raise ArgumentError, "The autosign configuration '%s' must be a fully qualified file" % auto unless auto =~ /^\//
+ raise ArgumentError, "The autosign configuration '#{auto}' must be a fully qualified file" unless auto =~ /^\//
if FileTest.exist?(auto)
return auto
else
@@ -117,7 +117,7 @@ class Puppet::SSL::CertificateAuthority
# Generate a new certificate.
def generate(name)
- raise ArgumentError, "A Certificate already exists for %s" % name if Puppet::SSL::Certificate.find(name)
+ raise ArgumentError, "A Certificate already exists for #{name}" if Puppet::SSL::Certificate.find(name)
host = Puppet::SSL::Host.new(name)
host.generate_certificate_request
@@ -170,7 +170,7 @@ class Puppet::SSL::CertificateAuthority
begin
Puppet.settings.write(:capass) { |f| f.print pass }
rescue Errno::EACCES => detail
- raise Puppet::Error, "Could not write CA password: %s" % detail.to_s
+ raise Puppet::Error, "Could not write CA password: #{detail}"
end
@password = pass
@@ -228,7 +228,7 @@ class Puppet::SSL::CertificateAuthority
if cert = Puppet::SSL::Certificate.find(name)
serial = cert.content.serial
elsif ! serial = inventory.serial(name)
- raise ArgumentError, "Could not find a serial number for %s" % name
+ raise ArgumentError, "Could not find a serial number for #{name}"
end
crl.revoke(serial, host.key.content)
end
@@ -249,7 +249,7 @@ class Puppet::SSL::CertificateAuthority
issuer = csr.content
else
unless csr = Puppet::SSL::CertificateRequest.find(hostname)
- raise ArgumentError, "Could not find certificate request for %s" % hostname
+ raise ArgumentError, "Could not find certificate request for #{hostname}"
end
issuer = host.certificate.content
end
@@ -258,7 +258,7 @@ class Puppet::SSL::CertificateAuthority
cert.content = Puppet::SSL::CertificateFactory.new(cert_type, csr.content, issuer, next_serial).result
cert.content.sign(host.key.content, OpenSSL::Digest::SHA1.new)
- Puppet.notice "Signed certificate request for %s" % hostname
+ Puppet.notice "Signed certificate request for #{hostname}"
# Add the cert to the inventory before we save it, since
# otherwise we could end up with it being duplicated, if
@@ -278,7 +278,7 @@ class Puppet::SSL::CertificateAuthority
# Verify a given host's certificate.
def verify(name)
unless cert = Puppet::SSL::Certificate.find(name)
- raise ArgumentError, "Could not find a certificate for %s" % name
+ raise ArgumentError, "Could not find a certificate for #{name}"
end
store = OpenSSL::X509::Store.new
store.add_file Puppet[:cacert]
@@ -293,7 +293,7 @@ class Puppet::SSL::CertificateAuthority
def fingerprint(name, md = :MD5)
unless cert = Puppet::SSL::Certificate.find(name) || Puppet::SSL::CertificateRequest.find(name)
- raise ArgumentError, "Could not find a certificate or csr for %s" % name
+ raise ArgumentError, "Could not find a certificate or csr for #{name}"
end
cert.fingerprint(md)
end
diff --git a/lib/puppet/ssl/certificate_authority/interface.rb b/lib/puppet/ssl/certificate_authority/interface.rb
index ffae66d2d..64e983cf6 100644
--- a/lib/puppet/ssl/certificate_authority/interface.rb
+++ b/lib/puppet/ssl/certificate_authority/interface.rb
@@ -14,7 +14,7 @@ module Puppet
# Actually perform the work.
def apply(ca)
unless subjects or method == :list
- raise ArgumentError, "You must provide hosts or :all when using %s" % method
+ raise ArgumentError, "You must provide hosts or :all when using #{method}"
end
begin
@@ -29,7 +29,7 @@ module Puppet
raise
rescue => detail
puts detail.backtrace if Puppet[:trace]
- Puppet.err "Could not call %s: %s" % [method, detail]
+ Puppet.err "Could not call #{method}: #{detail}"
end
end
@@ -84,7 +84,7 @@ module Puppet
# Set the method to apply.
def method=(method)
- raise ArgumentError, "Invalid method %s to apply" % method unless INTERFACE_METHODS.include?(method)
+ raise ArgumentError, "Invalid method #{method} to apply" unless INTERFACE_METHODS.include?(method)
@method = method
end
@@ -94,7 +94,7 @@ module Puppet
if value = ca.print(host)
puts value
else
- Puppet.err "Could not find certificate for %s" % host
+ Puppet.err "Could not find certificate for #{host}"
end
end
end
@@ -105,7 +105,7 @@ module Puppet
if value = ca.fingerprint(host, @digest)
puts "#{host} #{value}"
else
- Puppet.err "Could not find certificate for %s" % host
+ Puppet.err "Could not find certificate for #{host}"
end
end
end
@@ -122,7 +122,7 @@ module Puppet
# Set the list of hosts we're operating on. Also supports keywords.
def subjects=(value)
unless value == :all or value == :signed or value.is_a?(Array)
- raise ArgumentError, "Subjects must be an array or :all; not %s" % value
+ raise ArgumentError, "Subjects must be an array or :all; not #{value}"
end
if value.is_a?(Array) and value.empty?
diff --git a/lib/puppet/ssl/certificate_factory.rb b/lib/puppet/ssl/certificate_factory.rb
index 73b8a54c3..9273bb902 100644
--- a/lib/puppet/ssl/certificate_factory.rb
+++ b/lib/puppet/ssl/certificate_factory.rb
@@ -61,7 +61,7 @@ class Puppet::SSL::CertificateFactory
begin
send(method)
rescue NoMethodError
- raise ArgumentError, "%s is an invalid certificate type" % @cert_type
+ raise ArgumentError, "#{@cert_type} is an invalid certificate type"
end
@extensions << @ef.create_extension("nsComment", "Puppet Ruby/OpenSSL Generated Certificate")
diff --git a/lib/puppet/ssl/certificate_request.rb b/lib/puppet/ssl/certificate_request.rb
index f18fe4a16..3cd3ce0be 100644
--- a/lib/puppet/ssl/certificate_request.rb
+++ b/lib/puppet/ssl/certificate_request.rb
@@ -24,7 +24,7 @@ class Puppet::SSL::CertificateRequest < Puppet::SSL::Base
# How to create a certificate request with our system defaults.
def generate(key)
- Puppet.info "Creating a new SSL certificate request for %s" % name
+ Puppet.info "Creating a new SSL certificate request for #{name}"
# Support either an actual SSL key, or a Puppet key.
key = key.content if key.is_a?(Puppet::SSL::Key)
@@ -40,7 +40,7 @@ class Puppet::SSL::CertificateRequest < Puppet::SSL::Base
csr.public_key = key.public_key
csr.sign(key, OpenSSL::Digest::MD5.new)
- raise Puppet::Error, "CSR sign verification failed; you need to clean the certificate request for %s on the server" % name unless csr.verify(key.public_key)
+ raise Puppet::Error, "CSR sign verification failed; you need to clean the certificate request for #{name} on the server" unless csr.verify(key.public_key)
@content = csr
Puppet.info "Certificate Request fingerprint (md5): #{fingerprint}"
diff --git a/lib/puppet/ssl/certificate_revocation_list.rb b/lib/puppet/ssl/certificate_revocation_list.rb
index c725bde48..b2bff4830 100644
--- a/lib/puppet/ssl/certificate_revocation_list.rb
+++ b/lib/puppet/ssl/certificate_revocation_list.rb
@@ -53,7 +53,7 @@ class Puppet::SSL::CertificateRevocationList < Puppet::SSL::Base
# CA, then write the CRL back to disk. The REASON must be one of the
# OpenSSL::OCSP::REVOKED_* reasons
def revoke(serial, cakey, reason = OpenSSL::OCSP::REVOKED_STATUS_KEYCOMPROMISE)
- Puppet.notice "Revoked certificate with serial %s" % serial
+ Puppet.notice "Revoked certificate with serial #{serial}"
time = Time.now
# Add our revocation to the CRL.
diff --git a/lib/puppet/ssl/host.rb b/lib/puppet/ssl/host.rb
index f367adaca..6d1ae1a16 100644
--- a/lib/puppet/ssl/host.rb
+++ b/lib/puppet/ssl/host.rb
@@ -85,7 +85,7 @@ class Puppet::SSL::Host
# Specify how we expect to interact with our certificate authority.
def self.ca_location=(mode)
- raise ArgumentError, "CA Mode can only be %s" % CA_MODES.collect { |m| m.to_s }.join(", ") unless CA_MODES.include?(mode)
+ raise ArgumentError, "CA Mode can only be #{CA_MODES.collect { |m| m.to_s }.join(", ")}" unless CA_MODES.include?(mode)
@ca_location = mode
@@ -231,7 +231,7 @@ class Puppet::SSL::Host
raise
rescue Exception => detail
puts detail.backtrace if Puppet[:trace]
- Puppet.err "Could not request certificate: %s" % detail.to_s
+ Puppet.err "Could not request certificate: #{detail}"
if time < 1
puts "Exiting; failed to retrieve certificate and waitforcert is disabled"
exit(1)
@@ -253,7 +253,7 @@ class Puppet::SSL::Host
Puppet.notice "Did not receive certificate"
rescue StandardError => detail
puts detail.backtrace if Puppet[:trace]
- Puppet.err "Could not request certificate: %s" % detail.to_s
+ Puppet.err "Could not request certificate: #{detail}"
end
end
end
diff --git a/lib/puppet/ssl/key.rb b/lib/puppet/ssl/key.rb
index d91df03f6..cb03729c1 100644
--- a/lib/puppet/ssl/key.rb
+++ b/lib/puppet/ssl/key.rb
@@ -18,7 +18,7 @@ class Puppet::SSL::Key < Puppet::SSL::Base
# Knows how to create keys with our system defaults.
def generate
- Puppet.info "Creating a new SSL key for %s" % name
+ Puppet.info "Creating a new SSL key for #{name}"
@content = OpenSSL::PKey::RSA.new(Puppet[:keylength].to_i)
end