summaryrefslogtreecommitdiffstats
path: root/lib/puppet/network
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/network')
-rw-r--r--lib/puppet/network/authconfig.rb26
-rw-r--r--lib/puppet/network/authorization.rb20
-rwxr-xr-xlib/puppet/network/authstore.rb6
-rw-r--r--lib/puppet/network/client.rb8
-rw-r--r--lib/puppet/network/client/ca.rb6
-rw-r--r--lib/puppet/network/client/proxy.rb4
-rw-r--r--lib/puppet/network/client_request.rb2
-rw-r--r--lib/puppet/network/format.rb30
-rw-r--r--lib/puppet/network/format_handler.rb4
-rw-r--r--lib/puppet/network/handler.rb4
-rw-r--r--lib/puppet/network/handler/ca.rb20
-rwxr-xr-xlib/puppet/network/handler/fileserver.rb54
-rw-r--r--lib/puppet/network/handler/master.rb2
-rwxr-xr-xlib/puppet/network/handler/report.rb12
-rw-r--r--lib/puppet/network/http/api/v1.rb10
-rw-r--r--lib/puppet/network/http/handler.rb14
-rw-r--r--lib/puppet/network/http/rack.rb2
-rw-r--r--lib/puppet/network/http/rack/xmlrpc.rb6
-rw-r--r--lib/puppet/network/http/webrick.rb4
-rw-r--r--lib/puppet/network/http_pool.rb2
-rw-r--r--lib/puppet/network/http_server/mongrel.rb4
-rw-r--r--lib/puppet/network/http_server/webrick.rb8
-rw-r--r--lib/puppet/network/rest_authconfig.rb2
-rwxr-xr-xlib/puppet/network/rights.rb22
-rw-r--r--lib/puppet/network/server.rb14
-rw-r--r--lib/puppet/network/xmlrpc/client.rb20
-rw-r--r--lib/puppet/network/xmlrpc/processor.rb4
-rw-r--r--lib/puppet/network/xmlrpc/webrick_servlet.rb2
28 files changed, 156 insertions, 156 deletions
diff --git a/lib/puppet/network/authconfig.rb b/lib/puppet/network/authconfig.rb
index 3ee4df306..7c3a51743 100644
--- a/lib/puppet/network/authconfig.rb
+++ b/lib/puppet/network/authconfig.rb
@@ -72,13 +72,13 @@ module Puppet
if tmp == @configstamp
return
else
- Puppet.notice "%s vs %s" % [tmp, @configstamp]
+ Puppet.notice "#{tmp} vs #{@configstamp}"
end
else
return
end
else
- Puppet.notice "%s and %s" % [@configtimeout, @configstatted]
+ Puppet.notice "#{@configtimeout} and #{@configstatted}"
end
end
@@ -114,19 +114,19 @@ module Puppet
when /^\s*(allow|deny|method|environment|auth(?:enticated)?)\s+(.+)$/
parse_right_directive(right, $1, $2, count)
else
- raise ConfigurationError, "Invalid line %s: %s" % [count, line]
+ raise ConfigurationError, "Invalid line #{count}: #{line}"
end
count += 1
}
}
rescue Errno::EACCES => detail
- Puppet.err "Configuration error: Cannot read %s; cannot serve" % @file
- #raise Puppet::Error, "Cannot read %s" % @config
+ Puppet.err "Configuration error: Cannot read #{@file}; cannot serve"
+ #raise Puppet::Error, "Cannot read #{@config}"
rescue Errno::ENOENT => detail
- Puppet.err "Configuration error: '%s' does not exit; cannot serve" % @file
- #raise Puppet::Error, "%s does not exit" % @config
+ Puppet.err "Configuration error: '#{@file}' does not exit; cannot serve"
+ #raise Puppet::Error, "#{@config} does not exit"
#rescue FileServerError => detail
- # Puppet.err "FileServer error: %s" % detail
+ # Puppet.err "FileServer error: #{detail}"
end
# Verify each of the rights are valid.
@@ -146,22 +146,22 @@ module Puppet
modify_right(right, :deny, value, "denying %s access", count)
when "method"
unless right.acl_type == :regex
- raise ConfigurationError, "'method' directive not allowed in namespace ACL at line %s of %s" % [count, @config]
+ raise ConfigurationError, "'method' directive not allowed in namespace ACL at line #{count} of #{@config}"
end
modify_right(right, :restrict_method, value, "allowing 'method' %s", count)
when "environment"
unless right.acl_type == :regex
- raise ConfigurationError, "'environment' directive not allowed in namespace ACL at line %s of %s" % [count, @config]
+ raise ConfigurationError, "'environment' directive not allowed in namespace ACL at line #{count} of #{@config}"
end
modify_right(right, :restrict_environment, value, "adding environment %s", count)
when /auth(?:enticated)?/
unless right.acl_type == :regex
- raise ConfigurationError, "'authenticated' directive not allowed in namespace ACL at line %s of %s" % [count, @config]
+ raise ConfigurationError, "'authenticated' directive not allowed in namespace ACL at line #{count} of #{@config}"
end
modify_right(right, :restrict_authenticated, value, "adding authentication %s", count)
else
raise ConfigurationError,
- "Invalid argument '%s' at line %s" % [var, count]
+ "Invalid argument '#{var}' at line #{count}"
end
end
@@ -171,7 +171,7 @@ module Puppet
right.info msg % val
right.send(method, val)
rescue AuthStoreError => detail
- raise ConfigurationError, "%s at line %s of %s" % [detail.to_s, count, @file]
+ raise ConfigurationError, "#{detail} at line #{count} of #{@file}"
end
end
end
diff --git a/lib/puppet/network/authorization.rb b/lib/puppet/network/authorization.rb
index d65aeeb6a..97db59338 100644
--- a/lib/puppet/network/authorization.rb
+++ b/lib/puppet/network/authorization.rb
@@ -20,31 +20,31 @@ module Puppet::Network
# Verify that our client has access. We allow untrusted access to
# puppetca methods but no others.
def authorized?(request)
- msg = "%s client %s access to %s" % [request.authenticated? ? "authenticated" : "unauthenticated", request, request.call]
+ msg = "#{request.authenticated? ? "authenticated" : "unauthenticated"} client #{request} access to #{request.call}"
if request.authenticated?
if authconfig.exists?
if authconfig.allowed?(request)
- Puppet.debug "Allowing " + msg
+ Puppet.debug "Allowing #{msg}"
return true
else
- Puppet.notice "Denying " + msg
+ Puppet.notice "Denying #{msg}"
return false
end
else
if Puppet.run_mode.master?
- Puppet.debug "Allowing " + msg
+ Puppet.debug "Allowing #{msg}"
return true
else
- Puppet.notice "Denying " + msg
+ Puppet.notice "Denying #{msg}"
return false
end
end
else
if request.handler == "puppetca"
- Puppet.notice "Allowing " + msg
+ Puppet.notice "Allowing #{msg}"
else
- Puppet.notice "Denying " + msg
+ Puppet.notice "Denying #{msg}"
return false
end
end
@@ -55,7 +55,7 @@ module Puppet::Network
if handler_loaded?(request.handler)
return true
else
- Puppet.warning "Client %s requested unavailable functionality %s" % [request, request.handler]
+ Puppet.warning "Client #{request} requested unavailable functionality #{request.handler}"
return false
end
end
@@ -64,12 +64,12 @@ module Puppet::Network
def verify(request)
unless available?(request)
raise InvalidClientRequest.new(
- "Functionality %s not available" % request.handler
+ "Functionality #{request.handler} not available"
)
end
unless authorized?(request)
raise InvalidClientRequest.new(
- "Host %s not authorized to call %s" % [request, request.call]
+ "Host #{request} not authorized to call #{request.call}"
)
end
end
diff --git a/lib/puppet/network/authstore.rb b/lib/puppet/network/authstore.rb
index eb3400dd9..dc3451e34 100755
--- a/lib/puppet/network/authstore.rb
+++ b/lib/puppet/network/authstore.rb
@@ -49,7 +49,7 @@ module Puppet
return decl.result
end
- info "defaulting to no access for %s" % name
+ info "defaulting to no access for #{name}"
return false
end
@@ -176,7 +176,7 @@ module Puppet
def type=(type)
type = symbolize(type)
unless [:allow, :deny].include?(type)
- raise ArgumentError, "Invalid declaration type %s" % type
+ raise ArgumentError, "Invalid declaration type #{type}"
end
@type = type
end
@@ -247,7 +247,7 @@ module Puppet
when /^\w[-.@\w]*$/ # ? Just like a host name but allow '@'s and ending '.'s
[:opaque,:exact,nil,[value]]
else
- raise AuthStoreError, "Invalid pattern %s" % value
+ raise AuthStoreError, "Invalid pattern #{value}"
end
end
end
diff --git a/lib/puppet/network/client.rb b/lib/puppet/network/client.rb
index f53dd3a79..7bdde65be 100644
--- a/lib/puppet/network/client.rb
+++ b/lib/puppet/network/client.rb
@@ -106,7 +106,7 @@ class Puppet::Network::Client
end
@local = true
else
- raise Puppet::Network::ClientError, "%s must be passed a Server or %s" % [self.class, driverparam]
+ raise Puppet::Network::ClientError, "#{self.class} must be passed a Server or #{driverparam}"
end
end
@@ -135,12 +135,12 @@ class Puppet::Network::Client
self.lastrun = Time.now.to_i
rescue => detail
puts detail.backtrace if Puppet[:trace]
- Puppet.err "Could not run %s: %s" % [self.class, detail]
+ Puppet.err "Could not run #{self.class}: #{detail}"
end
end
def run
- raise Puppet::DevError, "Client type %s did not override run" % self.class
+ raise Puppet::DevError, "Client type #{self.class} did not override run"
end
def scheduled?
@@ -179,7 +179,7 @@ class Puppet::Network::Client
self.runnow if self.scheduled?
rescue => detail
puts detail.backtrace if Puppet[:trace]
- Puppet.err "Could not run client; got otherwise uncaught exception: %s" % detail
+ Puppet.err "Could not run client; got otherwise uncaught exception: #{detail}"
end
end
diff --git a/lib/puppet/network/client/ca.rb b/lib/puppet/network/client/ca.rb
index 5fbdfe9e3..2b96cd681 100644
--- a/lib/puppet/network/client/ca.rb
+++ b/lib/puppet/network/client/ca.rb
@@ -28,7 +28,7 @@ class Puppet::Network::Client::CA < Puppet::Network::Client
if Puppet[:trace]
puts detail.backtrace
end
- raise Puppet::Error.new("Certificate retrieval failed: %s" % detail)
+ raise Puppet::Error.new("Certificate retrieval failed: #{detail}")
end
if cert.nil? or cert == ""
@@ -40,12 +40,12 @@ class Puppet::Network::Client::CA < Puppet::Network::Client
@cacert = OpenSSL::X509::Certificate.new(cacert)
rescue => detail
raise InvalidCertificate.new(
- "Invalid certificate: %s" % detail
+ "Invalid certificate: #{detail}"
)
end
unless @cert.check_private_key(key)
- raise InvalidCertificate, "Certificate does not match private key. Try 'puppetca --clean %s' on the server." % Puppet[:certname]
+ raise InvalidCertificate, "Certificate does not match private key. Try 'puppetca --clean #{Puppet[:certname]}' on the server."
end
# Only write the cert out if it passes validating.
diff --git a/lib/puppet/network/client/proxy.rb b/lib/puppet/network/client/proxy.rb
index 17b1b0e14..d3fc9d142 100644
--- a/lib/puppet/network/client/proxy.rb
+++ b/lib/puppet/network/client/proxy.rb
@@ -9,7 +9,7 @@ class Puppet::Network::Client::ProxyClient < Puppet::Network::Client
interface.methods.each { |ary|
method = ary[0]
- Puppet.debug "%s: defining %s.%s" % [self, namespace, method]
+ Puppet.debug "#{self}: defining #{namespace}.#{method}"
define_method(method) { |*args|
begin
@driver.send(method, *args)
@@ -17,7 +17,7 @@ class Puppet::Network::Client::ProxyClient < Puppet::Network::Client
#Puppet.err "Could not call %s.%s: %s" %
# [namespace, method, detail.faultString]
#raise NetworkClientError,
- # "XMLRPC Error: %s" % detail.faultString
+ # "XMLRPC Error: #{detail.faultString}"
raise NetworkClientError, detail.faultString
end
}
diff --git a/lib/puppet/network/client_request.rb b/lib/puppet/network/client_request.rb
index 86dd31bcf..07c974799 100644
--- a/lib/puppet/network/client_request.rb
+++ b/lib/puppet/network/client_request.rb
@@ -24,7 +24,7 @@ module Puppet::Network # :nodoc:
end
def to_s
- "%s(%s)" % [self.name, self.ip]
+ "#{self.name}(#{self.ip})"
end
end
end
diff --git a/lib/puppet/network/format.rb b/lib/puppet/network/format.rb
index 7c3cc7bd8..59082c72a 100644
--- a/lib/puppet/network/format.rb
+++ b/lib/puppet/network/format.rb
@@ -27,13 +27,13 @@ class Puppet::Network::Format
define_method_names()
method_list = {
- :intern_method => "from_%s" % name,
- :intern_multiple_method => "from_multiple_%s" % name,
- :render_multiple_method => "to_multiple_%s" % name,
- :render_method => "to_%s" % name
+ :intern_method => "from_#{name}",
+ :intern_multiple_method => "from_multiple_#{name}",
+ :render_multiple_method => "to_multiple_#{name}",
+ :render_method => "to_#{name}"
}
- init_attribute(:mime, "text/%s" % name)
+ init_attribute(:mime, "text/#{name}")
init_attribute(:weight, 5)
init_attribute(:required_methods, method_list.keys)
init_attribute(:extension, name.to_s)
@@ -43,7 +43,7 @@ class Puppet::Network::Format
end
unless @options.empty?
- raise ArgumentError, "Unsupported option(s) %s" % @options.keys
+ raise ArgumentError, "Unsupported option(s) #{@options.keys}"
end
@options = nil
@@ -53,12 +53,12 @@ class Puppet::Network::Format
def intern(klass, text)
return klass.send(intern_method, text) if klass.respond_to?(intern_method)
- raise NotImplementedError, "%s does not respond to %s; can not intern instances from %s" % [klass, intern_method, mime]
+ raise NotImplementedError, "#{klass} does not respond to #{intern_method}; can not intern instances from #{mime}"
end
def intern_multiple(klass, text)
return klass.send(intern_multiple_method, text) if klass.respond_to?(intern_multiple_method)
- raise NotImplementedError, "%s does not respond to %s; can not intern multiple instances from %s" % [klass, intern_multiple_method, mime]
+ raise NotImplementedError, "#{klass} does not respond to #{intern_multiple_method}; can not intern multiple instances from #{mime}"
end
def mime=(mime)
@@ -67,13 +67,13 @@ class Puppet::Network::Format
def render(instance)
return instance.send(render_method) if instance.respond_to?(render_method)
- raise NotImplementedError, "%s does not respond to %s; can not render instances to %s" % [instance.class, render_method, mime]
+ raise NotImplementedError, "#{instance.class} does not respond to #{render_method}; can not render instances to #{mime}"
end
def render_multiple(instances)
# This method implicitly assumes that all instances are of the same type.
return instances[0].class.send(render_multiple_method, instances) if instances[0].class.respond_to?(render_multiple_method)
- raise NotImplementedError, "%s does not respond to %s; can not intern multiple instances to %s" % [instances[0].class, render_multiple_method, mime]
+ raise NotImplementedError, "#{instances[0].class} does not respond to #{render_multiple_method}; can not intern multiple instances to #{mime}"
end
def required_methods_present?(klass)
@@ -91,16 +91,16 @@ class Puppet::Network::Format
end
def to_s
- "Puppet::Network::Format[%s]" % name
+ "Puppet::Network::Format[#{name}]"
end
private
def define_method_names
- @intern_method = "from_%s" % name
- @render_method = "to_%s" % name
- @intern_multiple_method = "from_multiple_%s" % name
- @render_multiple_method = "to_multiple_%s" % name
+ @intern_method = "from_#{name}"
+ @render_method = "to_#{name}"
+ @intern_multiple_method = "from_multiple_#{name}"
+ @render_multiple_method = "to_multiple_#{name}"
end
def required_method_present?(name, klass, type)
diff --git a/lib/puppet/network/format_handler.rb b/lib/puppet/network/format_handler.rb
index 17b804f79..c21979ea4 100644
--- a/lib/puppet/network/format_handler.rb
+++ b/lib/puppet/network/format_handler.rb
@@ -13,7 +13,7 @@ module Puppet::Network::FormatHandler
Puppet::Network::FormatHandler.format(format).send(method, *args)
rescue => details
direction = method.to_s.include?("intern") ? "from" : "to"
- error = FormatError.new("Could not %s %s %s: %s" % [method, direction, format, details])
+ error = FormatError.new("Could not #{method} #{direction} #{format}: #{details}")
error.set_backtrace(details.backtrace)
raise error
end
@@ -91,7 +91,7 @@ module Puppet::Network::FormatHandler
else
out = format(format)
end
- raise ArgumentError, "No format match the given format name or mime-type (%s)" % format if out.nil?
+ raise ArgumentError, "No format match the given format name or mime-type (#{format})" if out.nil?
out.name
end
diff --git a/lib/puppet/network/handler.rb b/lib/puppet/network/handler.rb
index 95e3101f2..3903bdc63 100644
--- a/lib/puppet/network/handler.rb
+++ b/lib/puppet/network/handler.rb
@@ -22,7 +22,7 @@ module Puppet::Network
if defined?(@interface)
return @interface
else
- raise Puppet::DevError, "Handler %s has no defined interface" % self
+ raise Puppet::DevError, "Handler #{self} has no defined interface"
end
end
@@ -31,7 +31,7 @@ module Puppet::Network
if side
side = side.intern if side.is_a?(String)
unless [:client, :server].include?(side)
- raise ArgumentError, "Invalid side registration '%s' for %s" % [side, self.name]
+ raise ArgumentError, "Invalid side registration '#{side}' for #{self.name}"
end
@side = side
else
diff --git a/lib/puppet/network/handler/ca.rb b/lib/puppet/network/handler/ca.rb
index 20d971007..8bafb5f9b 100644
--- a/lib/puppet/network/handler/ca.rb
+++ b/lib/puppet/network/handler/ca.rb
@@ -35,13 +35,13 @@ class Puppet::Network::Handler
# we only otherwise know how to handle files
unless autosign =~ /^\//
- raise Puppet::Error, "Invalid autosign value %s" % autosign.inspect
+ raise Puppet::Error, "Invalid autosign value #{autosign.inspect}"
end
unless FileTest.exists?(autosign)
unless defined?(@@warnedonautosign)
@@warnedonautosign = true
- Puppet.info "Autosign is enabled but %s is missing" % autosign
+ Puppet.info "Autosign is enabled but #{autosign} is missing"
end
return false
end
@@ -89,7 +89,7 @@ class Puppet::Network::Handler
hostname = nameary[1]
unless @ca
- Puppet.notice "Host %s asked for signing from non-CA master" % hostname
+ Puppet.notice "Host #{hostname} asked for signing from non-CA master"
return ""
end
@@ -102,9 +102,9 @@ class Puppet::Network::Handler
# first check to see if we already have a signed cert for the host
cert, cacert = ca.getclientcert(hostname)
if cert and cacert
- Puppet.info "Retrieving existing certificate for %s" % hostname
+ Puppet.info "Retrieving existing certificate for #{hostname}"
unless csr.public_key.to_s == cert.public_key.to_s
- raise Puppet::Error, "Certificate request does not match existing certificate; run 'puppetca --clean %s'." % hostname
+ raise Puppet::Error, "Certificate request does not match existing certificate; run 'puppetca --clean #{hostname}'."
end
return [cert.to_pem, cacert.to_pem]
elsif @ca
@@ -115,15 +115,15 @@ class Puppet::Network::Handler
# okay, we don't have a signed cert
# if we're a CA and autosign is turned on, then go ahead and sign
# the csr and return the results
- Puppet.info "Signing certificate for %s" % hostname
+ Puppet.info "Signing certificate for #{hostname}"
cert, cacert = @ca.sign(csr)
- #Puppet.info "Cert: %s; Cacert: %s" % [cert.class, cacert.class]
+ #Puppet.info "Cert: #{cert.class}; Cacert: #{cacert.class}"
return [cert.to_pem, cacert.to_pem]
else # just write out the csr for later signing
if @ca.getclientcsr(hostname)
- Puppet.info "Not replacing existing request from %s" % hostname
+ Puppet.info "Not replacing existing request from #{hostname}"
else
- Puppet.notice "Host %s has a waiting certificate request" % hostname
+ Puppet.notice "Host #{hostname} has a waiting certificate request"
@ca.storeclientcsr(csr)
end
return ["", ""]
@@ -142,7 +142,7 @@ class Puppet::Network::Handler
if FileTest.exists?(pkeyfile)
currentkey = File.open(pkeyfile) { |k| k.read }
unless currentkey == public_key.to_s
- raise Puppet::Error, "public keys for %s differ" % hostname
+ raise Puppet::Error, "public keys for #{hostname} differ"
end
else
File.open(pkeyfile, "w", 0644) { |f|
diff --git a/lib/puppet/network/handler/fileserver.rb b/lib/puppet/network/handler/fileserver.rb
index a48d05d91..756e74909 100755
--- a/lib/puppet/network/handler/fileserver.rb
+++ b/lib/puppet/network/handler/fileserver.rb
@@ -67,7 +67,7 @@ class Puppet::Network::Handler
mount, path = convert(url, client, clientip)
- mount.debug("Describing %s for %s" % [url, client]) if client
+ mount.debug("Describing #{url} for #{client}") if client
# use the mount to resolve the path for us.
return "" unless full_path = mount.file_path(path, client)
@@ -107,7 +107,7 @@ class Puppet::Network::Handler
if hash.include?(:Mount)
@passedconfig = true
unless hash[:Mount].is_a?(Hash)
- raise Puppet::DevError, "Invalid mount hash %s" % hash[:Mount].inspect
+ raise Puppet::DevError, "Invalid mount hash #{hash[:Mount].inspect}"
end
hash[:Mount].each { |dir, name|
@@ -131,14 +131,14 @@ class Puppet::Network::Handler
def list(url, links = :ignore, recurse = false, ignore = false, client = nil, clientip = nil)
mount, path = convert(url, client, clientip)
- mount.debug "Listing %s for %s" % [url, client] if client
+ mount.debug "Listing #{url} for #{client}" if client
return "" unless mount.path_exists?(path, client)
desc = mount.list(path, recurse, ignore, client)
if desc.length == 0
- mount.notice "Got no information on //%s/%s" % [mount, path]
+ mount.notice "Got no information on //#{mount}/#{path}"
return ""
end
@@ -158,7 +158,7 @@ class Puppet::Network::Handler
def mount(path, name)
if @mounts.include?(name)
if @mounts[name] != path
- raise FileServerError, "%s is already mounted at %s" % [@mounts[name].path, name]
+ raise FileServerError, "#{@mounts[name].path} is already mounted at #{name}"
else
# it's already mounted; no problem
return
@@ -167,7 +167,7 @@ class Puppet::Network::Handler
# Let the mounts do their own error-checking.
@mounts[name] = Mount.new(name, path)
- @mounts[name].info "Mounted %s" % path
+ @mounts[name].info "Mounted #{path}"
return @mounts[name]
end
@@ -180,7 +180,7 @@ class Puppet::Network::Handler
mount, path = convert(url, client, clientip)
if client
- mount.info "Sending %s to %s" % [url, client]
+ mount.info "Sending #{url} to #{client}"
end
unless mount.path_exists?(path, client)
@@ -217,8 +217,8 @@ class Puppet::Network::Handler
clientip = nil
end
unless mount.allowed?(client, clientip)
- mount.warning "%s cannot access %s" % [client, file]
- raise Puppet::AuthorizationError, "Cannot access %s" % mount
+ mount.warning "#{client} cannot access #{file}"
+ raise Puppet::AuthorizationError, "Cannot access #{mount}"
end
end
@@ -280,7 +280,7 @@ class Puppet::Network::Handler
when /\[([-\w]+)\]/
name = $1
if newmounts.include?(name)
- raise FileServerError, "%s is already mounted as %s in %s" % [newmounts[name], name, @configuration.file]
+ raise FileServerError, "#{newmounts[name]} is already mounted as #{name} in #{@configuration.file}"
end
mount = Mount.new(name)
newmounts[name] = mount
@@ -295,14 +295,14 @@ class Puppet::Network::Handler
begin
mount.path = value
rescue FileServerError => detail
- Puppet.err "Removing mount %s: %s" % [mount.name, detail]
+ Puppet.err "Removing mount #{mount.name}: #{detail}"
newmounts.delete(mount.name)
end
end
when "allow"
value.split(/\s*,\s*/).each { |val|
begin
- mount.info "allowing %s access" % val
+ mount.info "allowing #{val} access"
mount.allow(val)
rescue AuthStoreError => detail
puts detail.backtrace if Puppet[:trace]
@@ -316,7 +316,7 @@ class Puppet::Network::Handler
when "deny"
value.split(/\s*,\s*/).each { |val|
begin
- mount.info "denying %s access" % val
+ mount.info "denying #{val} access"
mount.deny(val)
rescue AuthStoreError => detail
@@ -327,19 +327,19 @@ class Puppet::Network::Handler
end
}
else
- raise FileServerError.new("Invalid argument '%s'" % var, count, @configuration.file)
+ raise FileServerError.new("Invalid argument '#{var}'", count, @configuration.file)
end
else
- raise FileServerError.new("Invalid line '%s'" % line.chomp, count, @configuration.file)
+ raise FileServerError.new("Invalid line '#{line.chomp}'", count, @configuration.file)
end
count += 1
}
}
rescue Errno::EACCES => detail
- Puppet.err "FileServer error: Cannot read %s; cannot serve" % @configuration
- #raise Puppet::Error, "Cannot read %s" % @configuration
+ Puppet.err "FileServer error: Cannot read #{@configuration}; cannot serve"
+ #raise Puppet::Error, "Cannot read #{@configuration}"
rescue Errno::ENOENT => detail
- Puppet.err "FileServer error: '%s' does not exist; cannot serve" % @configuration
+ Puppet.err "FileServer error: '#{@configuration}' does not exist; cannot serve"
end
unless newmounts[MODULES]
@@ -380,7 +380,7 @@ class Puppet::Network::Handler
# pointing to the specific problem.
newmounts.each { |name, mount|
unless mount.valid?
- raise FileServerError, "Invalid mount %s" % name
+ raise FileServerError, "Invalid mount #{name}"
end
}
@mounts = newmounts
@@ -398,11 +398,11 @@ class Puppet::Network::Handler
unless mount = modules_mount(mount_name, client)
unless mount = @mounts[mount_name]
- raise FileServerError, "Fileserver module '%s' not mounted" % mount_name
+ raise FileServerError, "Fileserver module '#{mount_name}' not mounted"
end
end
else
- raise FileServerError, "Fileserver error: Invalid path '%s'" % dir
+ raise FileServerError, "Fileserver error: Invalid path '#{dir}'"
end
if path.nil? or path == ''
@@ -448,7 +448,7 @@ class Puppet::Network::Handler
if client
map = clientmap(client)
else
- Puppet.notice "No client; expanding '%s' with local host" % path
+ Puppet.notice "No client; expanding '#{path}' with local host"
# Else, use the local information
map = localmap()
end
@@ -490,7 +490,7 @@ class Puppet::Network::Handler
# Create out object. It must have a name.
def initialize(name, path = nil)
unless name =~ %r{^[-\w]+$}
- raise FileServerError, "Invalid name format '%s'" % name
+ raise FileServerError, "Invalid name format '#{name}'"
end
@name = name
@@ -573,13 +573,13 @@ class Puppet::Network::Handler
@expandable = true
else
unless FileTest.exists?(path)
- raise FileServerError, "%s does not exist" % path
+ raise FileServerError, "#{path} does not exist"
end
unless FileTest.directory?(path)
- raise FileServerError, "%s is not a directory" % path
+ raise FileServerError, "#{path} is not a directory"
end
unless FileTest.readable?(path)
- raise FileServerError, "%s is not readable" % path
+ raise FileServerError, "#{path} is not readable"
end
@expandable = false
end
@@ -617,7 +617,7 @@ class Puppet::Network::Handler
end
def to_s
- "mount[%s]" % @name
+ "mount[#{@name}]"
end
# Verify our configuration is valid. This should really check to
diff --git a/lib/puppet/network/handler/master.rb b/lib/puppet/network/handler/master.rb
index d16733523..beb6e4c57 100644
--- a/lib/puppet/network/handler/master.rb
+++ b/lib/puppet/network/handler/master.rb
@@ -67,7 +67,7 @@ class Puppet::Network::Handler
when "marshal"
return CGI.escape(Marshal.dump(catalog.extract))
else
- raise "Invalid markup format '%s'" % format
+ raise "Invalid markup format '#{format}'"
end
end
diff --git a/lib/puppet/network/handler/report.rb b/lib/puppet/network/handler/report.rb
index 960b65f73..9f885518e 100755
--- a/lib/puppet/network/handler/report.rb
+++ b/lib/puppet/network/handler/report.rb
@@ -12,7 +12,7 @@ class Puppet::Network::Handler
# Add a new report type.
def self.newreport(name, options = {}, &block)
- Puppet.warning "The interface for registering report types has changed; use Puppet::Reports.register_report for report type %s" % name
+ Puppet.warning "The interface for registering report types has changed; use Puppet::Reports.register_report for report type #{name}"
Puppet::Reports.register_report(name, options, &block)
end
@@ -28,11 +28,11 @@ class Puppet::Network::Handler
report = CGI.unescape(report)
end
- Puppet.info "Processing reports %s for %s" % [reports().join(", "), client]
+ Puppet.info "Processing reports #{reports().join(", ")} for #{client}"
begin
process(report)
rescue => detail
- Puppet.err "Could not process report for %s: %s" % [client, detail]
+ Puppet.err "Could not process report for #{client}: #{detail}"
if Puppet[:trace]
puts detail.backtrace
end
@@ -49,7 +49,7 @@ class Puppet::Network::Handler
begin
report = YAML.load(yaml)
rescue => detail
- Puppet.warning "Could not load report: %s" % detail
+ Puppet.warning "Could not load report: #{detail}"
return
end
@@ -68,10 +68,10 @@ class Puppet::Network::Handler
if Puppet[:trace]
puts detail.backtrace
end
- Puppet.err "Report %s failed: %s" % [name, detail]
+ Puppet.err "Report #{name} failed: #{detail}"
end
else
- Puppet.warning "No report named '%s'" % name
+ Puppet.warning "No report named '#{name}'"
end
end
end
diff --git a/lib/puppet/network/http/api/v1.rb b/lib/puppet/network/http/api/v1.rb
index 6a5ff156a..25e27c486 100644
--- a/lib/puppet/network/http/api/v1.rb
+++ b/lib/puppet/network/http/api/v1.rb
@@ -19,14 +19,14 @@ module Puppet::Network::HTTP::API::V1
def uri2indirection(http_method, uri, params)
environment, indirection, key = uri.split("/", 4)[1..-1] # the first field is always nil because of the leading slash
- raise ArgumentError, "The environment must be purely alphanumeric, not '%s'" % environment unless environment =~ /^\w+$/
- raise ArgumentError, "The indirection name must be purely alphanumeric, not '%s'" % indirection unless indirection =~ /^\w+$/
+ raise ArgumentError, "The environment must be purely alphanumeric, not '#{environment}'" unless environment =~ /^\w+$/
+ raise ArgumentError, "The indirection name must be purely alphanumeric, not '#{indirection}'" unless indirection =~ /^\w+$/
method = indirection_method(http_method, indirection)
params[:environment] = environment
- raise ArgumentError, "No request key specified in %s" % uri if key == "" or key.nil?
+ raise ArgumentError, "No request key specified in #{uri}" if key == "" or key.nil?
key = URI.unescape(key)
@@ -40,11 +40,11 @@ module Puppet::Network::HTTP::API::V1
def indirection_method(http_method, indirection)
unless METHOD_MAP[http_method]
- raise ArgumentError, "No support for http method %s" % http_method
+ raise ArgumentError, "No support for http method #{http_method}"
end
unless method = METHOD_MAP[http_method][plurality(indirection)]
- raise ArgumentError, "No support for plural %s operations" % http_method
+ raise ArgumentError, "No support for plural #{http_method} operations"
end
return method
diff --git a/lib/puppet/network/http/handler.rb b/lib/puppet/network/http/handler.rb
index a76fefdcc..66e0c720e 100644
--- a/lib/puppet/network/http/handler.rb
+++ b/lib/puppet/network/http/handler.rb
@@ -37,14 +37,14 @@ module Puppet::Network::HTTP::Handler
return format
end
- raise "No specified acceptable formats (%s) are functional on this machine" % header
+ raise "No specified acceptable formats (#{header}) are functional on this machine"
end
def request_format(request)
if header = content_type_header(request)
header.gsub!(/\s*;.*$/,'') # strip any charset
format = Puppet::Network::FormatHandler.mime(header)
- raise "Client sent a mime-type (%s) that doesn't correspond to a format we support" % header if format.nil?
+ raise "Client sent a mime-type (#{header}) that doesn't correspond to a format we support" if format.nil?
return format.name.to_s if format.suitable?
end
@@ -65,7 +65,7 @@ module Puppet::Network::HTTP::Handler
check_authorization(indirection_request)
- send("do_%s" % indirection_request.method, indirection_request, request, response)
+ send("do_#{indirection_request.method}", indirection_request, request, response)
rescue SystemExit,NoMemoryError
raise
rescue Exception => e
@@ -99,8 +99,8 @@ module Puppet::Network::HTTP::Handler
# Execute our find.
def do_find(indirection_request, request, response)
unless result = indirection_request.model.find(indirection_request.key, indirection_request.to_hash)
- Puppet.info("Could not find %s for '%s'" % [indirection_request.indirection_name, indirection_request.key])
- return do_exception(response, "Could not find %s %s" % [indirection_request.indirection_name, indirection_request.key], 404)
+ Puppet.info("Could not find #{indirection_request.indirection_name} for '#{indirection_request.key}'")
+ return do_exception(response, "Could not find #{indirection_request.indirection_name} #{indirection_request.key}", 404)
end
# The encoding of the result must include the format to use,
@@ -117,7 +117,7 @@ module Puppet::Network::HTTP::Handler
result = indirection_request.model.search(indirection_request.key, indirection_request.to_hash)
if result.nil? or (result.is_a?(Array) and result.empty?)
- return do_exception(response, "Could not find instances in %s with '%s'" % [indirection_request.indirection_name, indirection_request.to_hash.inspect], 404)
+ return do_exception(response, "Could not find instances in #{indirection_request.indirection_name} with '#{indirection_request.to_hash.inspect}'", 404)
end
format = format_to_use(request)
@@ -150,7 +150,7 @@ module Puppet::Network::HTTP::Handler
begin
return Resolv.getname(result[:ip])
rescue => detail
- Puppet.err "Could not resolve %s: %s" % [result[:ip], detail]
+ Puppet.err "Could not resolve #{result[:ip]}: #{detail}"
end
return result[:ip]
end
diff --git a/lib/puppet/network/http/rack.rb b/lib/puppet/network/http/rack.rb
index 756b66814..a5f69612d 100644
--- a/lib/puppet/network/http/rack.rb
+++ b/lib/puppet/network/http/rack.rb
@@ -54,7 +54,7 @@ class Puppet::Network::HTTP::Rack
# log what happened
Puppet.err "Puppet Server (Rack): Internal Server Error: Unhandled Exception: \"%s\"" % detail.message
Puppet.err "Backtrace:"
- detail.backtrace.each { |line| Puppet.err " > %s" % line }
+ detail.backtrace.each { |line| Puppet.err " > #{line}" }
end
response.finish()
end
diff --git a/lib/puppet/network/http/rack/xmlrpc.rb b/lib/puppet/network/http/rack/xmlrpc.rb
index 4fc9e82fc..49eb6fe49 100644
--- a/lib/puppet/network/http/rack/xmlrpc.rb
+++ b/lib/puppet/network/http/rack/xmlrpc.rb
@@ -6,9 +6,9 @@ class Puppet::Network::HTTP::RackXMLRPC < Puppet::Network::HTTP::RackHttpHandler
def initialize(handlers)
@xmlrpc_server = Puppet::Network::XMLRPCServer.new
handlers.each do |name|
- Puppet.debug " -> register xmlrpc namespace %s" % name
+ Puppet.debug " -> register xmlrpc namespace #{name}"
unless handler = Puppet::Network::Handler.handler(name)
- raise ArgumentError, "Invalid XMLRPC handler %s" % name
+ raise ArgumentError, "Invalid XMLRPC handler #{name}"
end
@xmlrpc_server.add_handler(handler.interface, handler.new({}))
end
@@ -52,7 +52,7 @@ class Puppet::Network::HTTP::RackXMLRPC < Puppet::Network::HTTP::RackHttpHandler
begin
node = Resolv.getname(ip)
rescue => detail
- Puppet.err "Could not resolve %s: %s" % [ip, detail]
+ Puppet.err "Could not resolve #{ip}: #{detail}"
node = "unknown"
end
authenticated = false
diff --git a/lib/puppet/network/http/webrick.rb b/lib/puppet/network/http/webrick.rb
index effe92434..d0533f7ff 100644
--- a/lib/puppet/network/http/webrick.rb
+++ b/lib/puppet/network/http/webrick.rb
@@ -98,7 +98,7 @@ class Puppet::Network::HTTP::WEBrick
# Get the cached copy. We know it's been generated, too.
host = Puppet::SSL::Host.localhost
- raise Puppet::Error, "Could not retrieve certificate for %s and not running on a valid certificate authority" % host.name unless host.certificate
+ raise Puppet::Error, "Could not retrieve certificate for #{host.name} and not running on a valid certificate authority" unless host.certificate
results[:SSLPrivateKey] = host.key.content
results[:SSLCertificate] = host.certificate.content
@@ -134,7 +134,7 @@ class Puppet::Network::HTTP::WEBrick
def xmlrpc_servlet
handlers = @xmlrpc_handlers.collect { |handler|
unless hclass = Puppet::Network::Handler.handler(handler)
- raise "Invalid xmlrpc handler %s" % handler
+ raise "Invalid xmlrpc handler #{handler}"
end
hclass.new({})
}
diff --git a/lib/puppet/network/http_pool.rb b/lib/puppet/network/http_pool.rb
index 980d3de13..458fe2c97 100644
--- a/lib/puppet/network/http_pool.rb
+++ b/lib/puppet/network/http_pool.rb
@@ -78,7 +78,7 @@ module Puppet::Network::HttpPool
# a new one.
def self.http_instance(host, port, reset = false)
# We overwrite the uninitialized @http here with a cached one.
- key = "%s:%s" % [host, port]
+ key = "#{host}:#{port}"
# Return our cached instance if we've got a cache, as long as we're not
# resetting the instance.
diff --git a/lib/puppet/network/http_server/mongrel.rb b/lib/puppet/network/http_server/mongrel.rb
index a10a42928..b26eee602 100644
--- a/lib/puppet/network/http_server/mongrel.rb
+++ b/lib/puppet/network/http_server/mongrel.rb
@@ -64,7 +64,7 @@ module Puppet::Network
@xmlrpc_server = Puppet::Network::XMLRPCServer.new
handlers.each do |name|
unless handler = Puppet::Network::Handler.handler(name)
- raise ArgumentError, "Invalid handler %s" % name
+ raise ArgumentError, "Invalid handler #{name}"
end
@xmlrpc_server.add_handler(handler.interface, handler.new({}))
end
@@ -129,7 +129,7 @@ module Puppet::Network
begin
client = Resolv.getname(ip)
rescue => detail
- Puppet.err "Could not resolve %s: %s" % [ip, detail]
+ Puppet.err "Could not resolve #{ip}: #{detail}"
client = "unknown"
end
valid = false
diff --git a/lib/puppet/network/http_server/webrick.rb b/lib/puppet/network/http_server/webrick.rb
index fa7ce4872..6cf5c91fe 100644
--- a/lib/puppet/network/http_server/webrick.rb
+++ b/lib/puppet/network/http_server/webrick.rb
@@ -69,7 +69,7 @@ module Puppet
# Create our server, yo.
def initialize(hash = {})
- Puppet.info "Starting server for Puppet version %s" % Puppet.version
+ Puppet.info "Starting server for Puppet version #{Puppet.version}"
if handlers = hash[:Handlers]
handler_instances = setup_handlers(handlers)
@@ -91,7 +91,7 @@ module Puppet
super(hash)
rescue => detail
puts detail.backtrace if Puppet[:trace]
- raise Puppet::Error, "Could not start WEBrick: %s" % detail
+ raise Puppet::Error, "Could not start WEBrick: #{detail}"
end
# make sure children don't inherit the sockets
@@ -99,7 +99,7 @@ module Puppet
sock.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
}
- Puppet.info "Listening on port %s" % hash[:Port]
+ Puppet.info "Listening on port #{hash[:Port]}"
# this creates a new servlet for every connection,
# but all servlets have the same list of handlers
@@ -129,7 +129,7 @@ module Puppet
handlers.collect { |handler, args|
hclass = nil
unless hclass = Puppet::Network::Handler.handler(handler)
- raise ServerError, "Invalid handler %s" % handler
+ raise ServerError, "Invalid handler #{handler}"
end
hclass.new(args)
}
diff --git a/lib/puppet/network/rest_authconfig.rb b/lib/puppet/network/rest_authconfig.rb
index 13ad8dbb4..b22a31461 100644
--- a/lib/puppet/network/rest_authconfig.rb
+++ b/lib/puppet/network/rest_authconfig.rb
@@ -63,7 +63,7 @@ module Puppet
def insert_default_acl
DEFAULT_ACL.each do |acl|
unless rights[acl[:acl]]
- Puppet.info "Inserting default '#{acl[:acl]}'(%s) acl because %s" % [acl[:authenticated] ? "auth" : "non-auth" , ( !exists? ? "#{Puppet[:rest_authconfig]} doesn't exist" : "none where found in '#{@file}'")]
+ Puppet.info "Inserting default '#{acl[:acl]}'(#{acl[:authenticated] ? "auth" : "non-auth"}) acl because #{( !exists? ? "#{Puppet[:rest_authconfig]} doesn't exist" : "none where found in '#{@file}'")}"
mk_acl(acl)
end
end
diff --git a/lib/puppet/network/rights.rb b/lib/puppet/network/rights.rb
index e8267c927..57f90727a 100755
--- a/lib/puppet/network/rights.rb
+++ b/lib/puppet/network/rights.rb
@@ -19,7 +19,7 @@ class Rights
if obj = self[name]
obj.send(method, *args)
else
- raise ArgumentError, "Unknown right '%s'" % name
+ raise ArgumentError, "Unknown right '#{name}'"
end
end
end
@@ -61,20 +61,20 @@ class Rights
# or failed, in any case will throw an error to the outside world
if name =~ /^\// or right
# we're a patch ACL, let's fail
- msg = "%s access to %s [%s]" % [ (args[:node].nil? ? args[:ip] : "#{args[:node]}(#{args[:ip]})"), name, args[:method] ]
+ msg = "#{(args[:node].nil? ? args[:ip] : "#{args[:node]}(#{args[:ip]})")} access to #{name} [#{args[:method]}]"
msg += " authenticated " if args[:authenticated]
- error = AuthorizationError.new("Forbidden request: " + msg)
+ error = AuthorizationError.new("Forbidden request: #{msg}")
if right
error.file = right.file
error.line = right.line
end
- Puppet.warning("Denying access: " + error.to_s)
+ Puppet.warning("Denying access: #{error}")
else
# there were no rights allowing/denying name
# if name is not a path, let's throw
- error = ArgumentError.new "Unknown namespace right '%s'" % name
+ error = ArgumentError.new "Unknown namespace right '#{name}'"
end
raise error
end
@@ -156,13 +156,13 @@ class Rights
@key = Regexp.new(@name)
@methods = ALL
else
- raise ArgumentError, "Unknown right type '%s'" % name
+ raise ArgumentError, "Unknown right type '#{name}'"
end
super()
end
def to_s
- "access[%s]" % @name
+ "access[#{@name}]"
end
# There's no real check to do at this point
@@ -198,7 +198,7 @@ class Rights
m = m.intern if m.is_a?(String)
unless ALL.include?(m)
- raise ArgumentError, "'%s' is not an allowed value for method directive" % m
+ raise ArgumentError, "'#{m}' is not an allowed value for method directive"
end
# if we were allowing all methods, then starts from scratch
@@ -207,7 +207,7 @@ class Rights
end
if @methods.include?(m)
- raise ArgumentError, "'%s' is already in the '%s' ACL" % [m, name]
+ raise ArgumentError, "'#{m}' is already in the '#{name}' ACL"
end
@methods << m
@@ -216,7 +216,7 @@ class Rights
def restrict_environment(env)
env = Puppet::Node::Environment.new(env)
if @environment.include?(env)
- raise ArgumentError, "'%s' is already in the '%s' ACL" % [env, name]
+ raise ArgumentError, "'#{env}' is already in the '#{name}' ACL"
end
@environment << env
@@ -231,7 +231,7 @@ class Rights
when "all","any", :all, :any
authentication = nil
else
- raise ArgumentError, "'%s' incorrect authenticated value: %s" % [name, authentication]
+ raise ArgumentError, "'#{name}' incorrect authenticated value: #{authentication}"
end
@authentication = authentication
end
diff --git a/lib/puppet/network/server.rb b/lib/puppet/network/server.rb
index 2c899cf15..eb22e1614 100644
--- a/lib/puppet/network/server.rb
+++ b/lib/puppet/network/server.rb
@@ -23,9 +23,9 @@ class Puppet::Network::Server
Puppet::Util::Log.reopen
rescue => detail
Puppet::Util.secure_open("/tmp/daemonout", "w") { |f|
- f.puts "Could not start %s: %s" % [Puppet[:name], detail]
+ f.puts "Could not start #{Puppet[:name]}: #{detail}"
}
- raise "Could not start %s: %s" % [Puppet[:name], detail]
+ raise "Could not start #{Puppet[:name]}: #{detail}"
end
end
@@ -34,7 +34,7 @@ class Puppet::Network::Server
def create_pidfile
Puppet::Util.sync(Puppet[:name]).synchronize(Sync::EX) do
unless Puppet::Util::Pidlock.new(pidfile).lock
- raise "Could not create PID file: %s" % [pidfile]
+ raise "Could not create PID file: #{pidfile}"
end
end
end
@@ -44,7 +44,7 @@ class Puppet::Network::Server
Puppet::Util.sync(Puppet[:name]).synchronize(Sync::EX) do
locker = Puppet::Util::Pidlock.new(pidfile)
if locker.locked?
- locker.unlock or Puppet.err "Could not remove PID file %s" % [pidfile]
+ locker.unlock or Puppet.err "Could not remove PID file #{pidfile}"
end
end
end
@@ -57,7 +57,7 @@ class Puppet::Network::Server
def initialize(args = {})
valid_args = [:handlers, :xmlrpc_handlers, :port]
bad_args = args.keys.find_all { |p| ! valid_args.include?(p) }.collect { |p| p.to_s }.join(",")
- raise ArgumentError, "Invalid argument(s) %s" % bad_args unless bad_args == ""
+ raise ArgumentError, "Invalid argument(s) #{bad_args}" unless bad_args == ""
@server_type = Puppet[:servertype] or raise "No servertype configuration found." # e.g., WEBrick, Mongrel, etc.
http_server_class || raise(ArgumentError, "Could not determine HTTP Server class for server type [#{@server_type}]")
@@ -90,7 +90,7 @@ class Puppet::Network::Server
indirections = @routes.keys if indirections.empty?
indirections.flatten.each do |i|
- raise(ArgumentError, "Indirection [%s] is unknown." % i) unless @routes[i.to_sym]
+ raise(ArgumentError, "Indirection [#{i}] is unknown.") unless @routes[i.to_sym]
end
indirections.flatten.each do |i|
@@ -113,7 +113,7 @@ class Puppet::Network::Server
namespaces = @xmlrpc_routes.keys if namespaces.empty?
namespaces.flatten.each do |i|
- raise(ArgumentError, "XMLRPC handler '%s' is unknown." % i) unless @xmlrpc_routes[i.to_sym]
+ raise(ArgumentError, "XMLRPC handler '#{i}' is unknown.") unless @xmlrpc_routes[i.to_sym]
end
namespaces.flatten.each do |i|
diff --git a/lib/puppet/network/xmlrpc/client.rb b/lib/puppet/network/xmlrpc/client.rb
index c5efe985d..828b8a77a 100644
--- a/lib/puppet/network/xmlrpc/client.rb
+++ b/lib/puppet/network/xmlrpc/client.rb
@@ -83,7 +83,7 @@ module Puppet::Network
Puppet.warning "Certificate validation failed; consider using the certname configuration option"
end
end
- raise XMLRPCClientError, "Certificates were not trusted: %s" % detail
+ raise XMLRPCClientError, "Certificates were not trusted: #{detail}"
end
handle_error(:default) do |client, detail, namespace, method|
@@ -91,7 +91,7 @@ module Puppet::Network
Puppet.warning "XMLRPC returned wrong size. Retrying."
return :retry
end
- Puppet.err "Could not call %s.%s: %s" % [namespace, method, detail.inspect]
+ Puppet.err "Could not call #{namespace}.#{method}: #{detail.inspect}"
error = XMLRPCClientError.new(detail.to_s)
error.set_backtrace detail.backtrace
raise error
@@ -108,7 +108,7 @@ module Puppet::Network
Puppet.warning "Certificate validation failed; consider using the certname configuration option"
end
end
- raise XMLRPCClientError, "Certificates were not trusted: %s" % detail
+ raise XMLRPCClientError, "Certificates were not trusted: #{detail}"
end
handle_error(::XMLRPC::FaultException) do |client, detail, namespace, method|
@@ -116,13 +116,13 @@ module Puppet::Network
end
handle_error(Errno::ECONNREFUSED) do |client, detail, namespace, method|
- msg = "Could not connect to %s on port %s" % [client.host, client.port]
+ msg = "Could not connect to #{client.host} on port #{client.port}"
raise XMLRPCClientError, msg
end
handle_error(SocketError) do |client, detail, namespace, method|
- Puppet.err "Could not find server %s: %s" % [@host, detail.to_s]
- error = XMLRPCClientError.new("Could not find server %s" % client.host)
+ Puppet.err "Could not find server #{@host}: #{detail}"
+ error = XMLRPCClientError.new("Could not find server #{client.host}")
error.set_backtrace detail.backtrace
raise error
end
@@ -134,16 +134,16 @@ module Puppet::Network
end
handle_error(Timeout::Error) do |client, detail, namespace, method|
- Puppet.err "Connection timeout calling %s.%s: %s" % [namespace, method, detail.to_s]
+ Puppet.err "Connection timeout calling #{namespace}.#{method}: #{detail}"
error = XMLRPCClientError.new("Connection Timeout")
error.set_backtrace(detail.backtrace)
raise error
end
def make_rpc_call(namespace, method, *args)
- Puppet.debug "Calling %s.%s" % [namespace, method]
+ Puppet.debug "Calling #{namespace}.#{method}"
begin
- call("%s.%s" % [namespace, method.to_s],*args)
+ call("#{namespace}.#{method}",*args)
rescue SystemExit,NoMemoryError
raise
rescue Exception => detail
@@ -207,7 +207,7 @@ module Puppet::Network
begin
@http.start unless @http.started?
rescue => detail
- Puppet.err "Could not connect to server: %s" % detail
+ Puppet.err "Could not connect to server: #{detail}"
end
end
diff --git a/lib/puppet/network/xmlrpc/processor.rb b/lib/puppet/network/xmlrpc/processor.rb
index 2c2dc61ec..14f91d8b4 100644
--- a/lib/puppet/network/xmlrpc/processor.rb
+++ b/lib/puppet/network/xmlrpc/processor.rb
@@ -53,7 +53,7 @@ module Puppet::Network
rescue ::XMLRPC::FaultException
raise
rescue Puppet::AuthorizationError => detail
- Puppet.err "Permission denied: %s" % detail.to_s
+ Puppet.err "Permission denied: #{detail}"
raise ::XMLRPC::FaultException.new(
1, detail.to_s
)
@@ -71,7 +71,7 @@ module Puppet::Network
if Puppet[:trace]
puts detail.backtrace
end
- Puppet.err "Could not call: %s" % detail.to_s
+ Puppet.err "Could not call: #{detail}"
error = ::XMLRPC::FaultException.new(1, detail.to_s)
error.set_backtrace detail.backtrace
raise error
diff --git a/lib/puppet/network/xmlrpc/webrick_servlet.rb b/lib/puppet/network/xmlrpc/webrick_servlet.rb
index a03db01d1..f58286c3a 100644
--- a/lib/puppet/network/xmlrpc/webrick_servlet.rb
+++ b/lib/puppet/network/xmlrpc/webrick_servlet.rb
@@ -106,7 +106,7 @@ module Puppet::Network::XMLRPC
Puppet.warning "Could not retrieve server name from cert"
else
unless client == nameary[1]
- Puppet.debug "Overriding %s with cert name %s" % [client, nameary[1]]
+ Puppet.debug "Overriding #{client} with cert name #{nameary[1]}"
client = nameary[1]
end
valid = true