summaryrefslogtreecommitdiffstats
path: root/lib/puppet/network/handler
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/network/handler')
-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
4 files changed, 44 insertions, 44 deletions
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