summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet.rb4
-rw-r--r--lib/puppet/agent.rb8
-rw-r--r--lib/puppet/application.rb4
-rw-r--r--lib/puppet/application/agent.rb6
-rw-r--r--lib/puppet/application/apply.rb8
-rw-r--r--lib/puppet/application/cert.rb2
-rw-r--r--lib/puppet/application/describe.rb6
-rw-r--r--lib/puppet/application/doc.rb20
-rw-r--r--lib/puppet/application/filebucket.rb6
-rw-r--r--lib/puppet/application/kick.rb22
-rw-r--r--lib/puppet/application/master.rb6
-rw-r--r--lib/puppet/application/queue.rb6
-rw-r--r--lib/puppet/application/resource.rb4
-rw-r--r--lib/puppet/configurer.rb12
-rw-r--r--lib/puppet/configurer/downloader.rb2
-rw-r--r--lib/puppet/configurer/fact_handler.rb2
-rw-r--r--lib/puppet/configurer/plugin_handler.rb4
-rwxr-xr-xlib/puppet/daemon.rb10
-rw-r--r--lib/puppet/error.rb6
-rw-r--r--lib/puppet/external/dot.rb2
-rwxr-xr-xlib/puppet/external/nagios/base.rb10
-rw-r--r--lib/puppet/external/nagios/parser.rb6
-rw-r--r--lib/puppet/file_bucket/dipper.rb6
-rw-r--r--lib/puppet/file_serving/base.rb2
-rw-r--r--lib/puppet/file_serving/configuration.rb8
-rw-r--r--lib/puppet/file_serving/configuration/parser.rb16
-rw-r--r--lib/puppet/file_serving/fileset.rb4
-rw-r--r--lib/puppet/file_serving/indirection_hooks.rb2
-rw-r--r--lib/puppet/file_serving/metadata.rb10
-rw-r--r--lib/puppet/file_serving/mount.rb4
-rw-r--r--lib/puppet/file_serving/mount/file.rb6
-rw-r--r--lib/puppet/indirector.rb2
-rw-r--r--lib/puppet/indirector/catalog/compiler.rb14
-rw-r--r--lib/puppet/indirector/certificate_request/ca.rb2
-rw-r--r--lib/puppet/indirector/exec.rb4
-rw-r--r--lib/puppet/indirector/facts/facter.rb6
-rw-r--r--lib/puppet/indirector/file.rb2
-rw-r--r--lib/puppet/indirector/file_server.rb2
-rw-r--r--lib/puppet/indirector/indirection.rb34
-rw-r--r--lib/puppet/indirector/key/file.rb4
-rw-r--r--lib/puppet/indirector/ldap.rb6
-rw-r--r--lib/puppet/indirector/memory.rb2
-rw-r--r--lib/puppet/indirector/node/exec.rb2
-rw-r--r--lib/puppet/indirector/node/ldap.rb8
-rw-r--r--lib/puppet/indirector/queue.rb8
-rw-r--r--lib/puppet/indirector/report/processor.rb4
-rw-r--r--lib/puppet/indirector/request.rb10
-rw-r--r--lib/puppet/indirector/rest.rb2
-rw-r--r--lib/puppet/indirector/ssl_file.rb14
-rw-r--r--lib/puppet/indirector/terminus.rb12
-rw-r--r--lib/puppet/indirector/yaml.rb6
-rw-r--r--lib/puppet/metatype/manager.rb6
-rw-r--r--lib/puppet/module.rb6
-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
-rw-r--r--lib/puppet/node.rb4
-rw-r--r--lib/puppet/parameter.rb12
-rw-r--r--lib/puppet/parameter/value_collection.rb14
-rw-r--r--lib/puppet/parser/ast.rb2
-rw-r--r--lib/puppet/parser/ast/arithmetic_operator.rb6
-rw-r--r--lib/puppet/parser/ast/boolean_operator.rb2
-rw-r--r--lib/puppet/parser/ast/branch.rb2
-rw-r--r--lib/puppet/parser/ast/collexpr.rb7
-rw-r--r--lib/puppet/parser/ast/comparison_operator.rb2
-rw-r--r--lib/puppet/parser/ast/function.rb10
-rw-r--r--lib/puppet/parser/ast/leaf.rb4
-rw-r--r--lib/puppet/parser/ast/match_operator.rb2
-rw-r--r--lib/puppet/parser/ast/minus.rb2
-rw-r--r--lib/puppet/parser/ast/resource_override.rb2
-rw-r--r--lib/puppet/parser/ast/selector.rb2
-rw-r--r--lib/puppet/parser/collector.rb8
-rw-r--r--lib/puppet/parser/compiler.rb8
-rw-r--r--lib/puppet/parser/functions.rb16
-rw-r--r--lib/puppet/parser/functions/file.rb2
-rw-r--r--lib/puppet/parser/functions/include.rb2
-rw-r--r--lib/puppet/parser/functions/inline_template.rb2
-rw-r--r--lib/puppet/parser/functions/require.rb2
-rw-r--r--lib/puppet/parser/functions/split.rb2
-rw-r--r--lib/puppet/parser/functions/template.rb4
-rw-r--r--lib/puppet/parser/lexer.rb4
-rw-r--r--lib/puppet/parser/parser_support.rb12
-rw-r--r--lib/puppet/parser/resource.rb10
-rw-r--r--lib/puppet/parser/resource/param.rb2
-rw-r--r--lib/puppet/parser/scope.rb20
-rw-r--r--lib/puppet/parser/templatewrapper.rb6
-rw-r--r--lib/puppet/parser/type_loader.rb2
-rw-r--r--lib/puppet/property/ensure.rb6
-rw-r--r--lib/puppet/provider.rb16
-rw-r--r--lib/puppet/provider/confine.rb6
-rw-r--r--lib/puppet/provider/confine/exists.rb2
-rw-r--r--lib/puppet/provider/confine/feature.rb2
-rw-r--r--lib/puppet/provider/confine/variable.rb2
-rwxr-xr-xlib/puppet/provider/cron/crontab.rb4
-rw-r--r--lib/puppet/provider/file/posix.rb8
-rw-r--r--lib/puppet/provider/file/win32.rb6
-rw-r--r--lib/puppet/provider/group/ldap.rb2
-rw-r--r--lib/puppet/provider/host/parsed.rb8
-rw-r--r--lib/puppet/provider/ldap.rb4
-rwxr-xr-xlib/puppet/provider/mailalias/aliases.rb2
-rwxr-xr-xlib/puppet/provider/maillist/mailman.rb2
-rw-r--r--lib/puppet/provider/naginator.rb4
-rw-r--r--lib/puppet/provider/nameservice.rb24
-rw-r--r--lib/puppet/provider/nameservice/directoryservice.rb22
-rw-r--r--lib/puppet/provider/package/aix.rb2
-rwxr-xr-xlib/puppet/provider/package/apt.rb4
-rwxr-xr-xlib/puppet/provider/package/aptitude.rb2
-rw-r--r--lib/puppet/provider/package/aptrpm.rb4
-rwxr-xr-xlib/puppet/provider/package/blastwave.rb2
-rwxr-xr-xlib/puppet/provider/package/darwinport.rb4
-rwxr-xr-xlib/puppet/provider/package/dpkg.rb8
-rwxr-xr-xlib/puppet/provider/package/fink.rb4
-rwxr-xr-xlib/puppet/provider/package/freebsd.rb4
-rwxr-xr-xlib/puppet/provider/package/gem.rb8
-rwxr-xr-xlib/puppet/provider/package/openbsd.rb2
-rw-r--r--lib/puppet/provider/package/pkg.rb6
-rw-r--r--lib/puppet/provider/package/pkgdmg.rb2
-rw-r--r--lib/puppet/provider/package/portage.rb6
-rwxr-xr-xlib/puppet/provider/package/ports.rb8
-rw-r--r--lib/puppet/provider/package/portupgrade.rb32
-rw-r--r--lib/puppet/provider/package/rug.rb4
-rw-r--r--lib/puppet/provider/package/up2date.rb2
-rw-r--r--lib/puppet/provider/package/urpmi.rb4
-rwxr-xr-xlib/puppet/provider/package/yum.rb4
-rw-r--r--lib/puppet/provider/package/zypper.rb4
-rwxr-xr-xlib/puppet/provider/parsedfile.rb6
-rwxr-xr-xlib/puppet/provider/port/parsed.rb10
-rw-r--r--lib/puppet/provider/selboolean/getsetsebool.rb2
-rw-r--r--lib/puppet/provider/selmodule/semodule.rb8
-rwxr-xr-xlib/puppet/provider/service/base.rb8
-rw-r--r--lib/puppet/provider/service/daemontools.rb20
-rw-r--r--lib/puppet/provider/service/gentoo.rb4
-rwxr-xr-xlib/puppet/provider/service/init.rb10
-rw-r--r--lib/puppet/provider/service/launchd.rb8
-rwxr-xr-xlib/puppet/provider/service/redhat.rb6
-rw-r--r--lib/puppet/provider/service/runit.rb2
-rwxr-xr-xlib/puppet/provider/service/smf.rb12
-rwxr-xr-xlib/puppet/provider/service/src.rb6
-rw-r--r--lib/puppet/provider/user/directoryservice.rb2
-rw-r--r--lib/puppet/provider/user/ldap.rb4
-rw-r--r--lib/puppet/provider/user/user_role_add.rb6
-rw-r--r--lib/puppet/provider/zone/solaris.rb20
-rw-r--r--lib/puppet/provider/zpool/solaris.rb2
-rw-r--r--lib/puppet/rails.rb10
-rw-r--r--lib/puppet/rails/benchmark.rb2
-rw-r--r--lib/puppet/rails/param_value.rb6
-rw-r--r--lib/puppet/rails/resource.rb2
-rw-r--r--lib/puppet/rails/resource_tag.rb4
-rw-r--r--lib/puppet/reference/configuration.rb4
-rw-r--r--lib/puppet/reference/metaparameter.rb4
-rw-r--r--lib/puppet/reference/providers.rb18
-rw-r--r--lib/puppet/reference/type.rb4
-rw-r--r--lib/puppet/relationship.rb2
-rwxr-xr-xlib/puppet/reports.rb2
-rw-r--r--lib/puppet/reports/log.rb2
-rw-r--r--lib/puppet/reports/rrdgraph.rb16
-rw-r--r--lib/puppet/reports/store.rb4
-rw-r--r--lib/puppet/reports/tagmail.rb18
-rw-r--r--lib/puppet/resource/catalog.rb28
-rw-r--r--lib/puppet/run.rb2
-rw-r--r--lib/puppet/simple_graph.rb6
-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
-rwxr-xr-xlib/puppet/sslcertificates.rb6
-rw-r--r--lib/puppet/sslcertificates/ca.rb26
-rw-r--r--lib/puppet/sslcertificates/certificate.rb2
-rw-r--r--lib/puppet/sslcertificates/support.rb18
-rw-r--r--lib/puppet/transaction.rb16
-rw-r--r--lib/puppet/transaction/change.rb2
-rw-r--r--lib/puppet/transaction/report.rb2
-rw-r--r--lib/puppet/transportable.rb8
-rw-r--r--lib/puppet/type.rb72
-rw-r--r--lib/puppet/type/component.rb2
-rwxr-xr-xlib/puppet/type/cron.rb6
-rwxr-xr-xlib/puppet/type/exec.rb22
-rw-r--r--lib/puppet/type/file.rb18
-rwxr-xr-xlib/puppet/type/file/content.rb8
-rwxr-xr-xlib/puppet/type/file/ensure.rb6
-rwxr-xr-xlib/puppet/type/file/group.rb10
-rwxr-xr-xlib/puppet/type/file/mode.rb12
-rwxr-xr-xlib/puppet/type/file/owner.rb4
-rwxr-xr-xlib/puppet/type/file/source.rb14
-rwxr-xr-xlib/puppet/type/filebucket.rb2
-rwxr-xr-xlib/puppet/type/group.rb4
-rwxr-xr-xlib/puppet/type/host.rb2
-rw-r--r--lib/puppet/type/k5login.rb2
-rw-r--r--lib/puppet/type/package.rb8
-rwxr-xr-xlib/puppet/type/port.rb2
-rw-r--r--lib/puppet/type/resources.rb8
-rwxr-xr-xlib/puppet/type/schedule.rb14
-rw-r--r--lib/puppet/type/ssh_authorized_key.rb2
-rwxr-xr-xlib/puppet/type/tidy.rb14
-rwxr-xr-xlib/puppet/type/user.rb4
-rw-r--r--lib/puppet/type/zone.rb12
-rwxr-xr-xlib/puppet/type/zpool.rb2
-rw-r--r--lib/puppet/util.rb26
-rw-r--r--lib/puppet/util/autoload.rb4
-rw-r--r--lib/puppet/util/backups.rb10
-rw-r--r--lib/puppet/util/cacher.rb4
-rw-r--r--lib/puppet/util/classgen.rb8
-rw-r--r--lib/puppet/util/constant_inflector.rb2
-rw-r--r--lib/puppet/util/docs.rb2
-rw-r--r--lib/puppet/util/errors.rb2
-rw-r--r--lib/puppet/util/feature.rb8
-rw-r--r--lib/puppet/util/file_locking.rb6
-rw-r--r--lib/puppet/util/fileparsing.rb18
-rwxr-xr-xlib/puppet/util/filetype.rb28
-rw-r--r--lib/puppet/util/inifile.rb2
-rwxr-xr-xlib/puppet/util/instance_loader.rb4
-rw-r--r--lib/puppet/util/ldap/connection.rb4
-rw-r--r--lib/puppet/util/ldap/manager.rb10
-rw-r--r--lib/puppet/util/log.rb8
-rw-r--r--lib/puppet/util/log/destinations.rb24
-rw-r--r--lib/puppet/util/methodhelper.rb2
-rw-r--r--lib/puppet/util/metric.rb16
-rw-r--r--lib/puppet/util/nagios_maker.rb6
-rwxr-xr-xlib/puppet/util/posix.rb4
-rw-r--r--lib/puppet/util/provider_features.rb6
-rw-r--r--lib/puppet/util/queue.rb4
-rw-r--r--lib/puppet/util/queue/stomp.rb6
-rw-r--r--lib/puppet/util/rdoc.rb2
-rw-r--r--lib/puppet/util/rdoc/code_objects.rb8
-rw-r--r--lib/puppet/util/rdoc/generators/puppet_generator.rb8
-rw-r--r--lib/puppet/util/rdoc/parser.rb30
-rw-r--r--lib/puppet/util/reference.rb24
-rw-r--r--lib/puppet/util/resource_template.rb2
-rw-r--r--lib/puppet/util/selinux.rb2
-rw-r--r--lib/puppet/util/settings.rb46
-rw-r--r--lib/puppet/util/settings/boolean_setting.rb2
-rw-r--r--lib/puppet/util/settings/file_setting.rb6
-rw-r--r--lib/puppet/util/settings/setting.rb10
-rw-r--r--lib/puppet/util/storage.rb10
-rw-r--r--lib/puppet/util/suidmanager.rb4
-rw-r--r--lib/puppet/util/tagging.rb2
265 files changed, 1055 insertions, 1056 deletions
diff --git a/lib/puppet.rb b/lib/puppet.rb
index d09c81801..7293ce2fb 100644
--- a/lib/puppet.rb
+++ b/lib/puppet.rb
@@ -132,13 +132,13 @@ module Puppet
Puppet.err detail.to_s
return false
rescue => detail
- Puppet.err "Could not create %s: %s" % [path, detail.to_s]
+ Puppet.err "Could not create #{path}: #{detail}"
return false
end
elsif FileTest.directory?(File.join(path))
next
else FileTest.exist?(File.join(path))
- raise Puppet::Error, "Cannot create %s: basedir %s is a file" % [dir, File.join(path)]
+ raise Puppet::Error, "Cannot create #{dir}: basedir #{File.join(path)} is a file"
end
}
return true
diff --git a/lib/puppet/agent.rb b/lib/puppet/agent.rb
index 84bda6756..3c8a2af67 100644
--- a/lib/puppet/agent.rb
+++ b/lib/puppet/agent.rb
@@ -28,7 +28,7 @@ class Puppet::Agent
# Perform a run with our client.
def run(*args)
if running?
- Puppet.notice "Run of %s already in progress; skipping" % client_class
+ Puppet.notice "Run of #{client_class} already in progress; skipping"
return
end
result = nil
@@ -39,7 +39,7 @@ class Puppet::Agent
sync.synchronize { lock { result = client.run(*args) } }
rescue => detail
puts detail.backtrace if Puppet[:trace]
- Puppet.err "Could not run %s: %s" % [client_class, detail]
+ Puppet.err "Could not run #{client_class}: #{detail}"
end
end
true
@@ -63,7 +63,7 @@ class Puppet::Agent
return if splayed?
time = rand(Integer(Puppet[:splaylimit]) + 1)
- Puppet.info "Sleeping for %s seconds (splay is enabled)" % time
+ Puppet.info "Sleeping for #{time} seconds (splay is enabled)"
sleep(time)
@splayed = true
end
@@ -98,7 +98,7 @@ class Puppet::Agent
raise
rescue Exception => detail
puts detail.backtrace if Puppet[:trace]
- Puppet.err "Could not create instance of %s: %s" % [client_class, detail]
+ Puppet.err "Could not create instance of #{client_class}: #{detail}"
return
end
yield @client
diff --git a/lib/puppet/application.rb b/lib/puppet/application.rb
index 7e7a2a962..db297e073 100644
--- a/lib/puppet/application.rb
+++ b/lib/puppet/application.rb
@@ -241,7 +241,7 @@ class Application
# Every app responds to --version
option("--version", "-V") do |arg|
- puts "%s" % Puppet.version
+ puts "#{Puppet.version}"
exit
end
@@ -405,7 +405,7 @@ class Application
yield
rescue RuntimeError, NotImplementedError => detail
puts detail.backtrace if Puppet[:trace]
- $stderr.puts "Could not %s: %s" % [message, detail]
+ $stderr.puts "Could not #{message}: #{detail}"
exit(code)
end
end
diff --git a/lib/puppet/application/agent.rb b/lib/puppet/application/agent.rb
index ab47abc38..fce978d88 100644
--- a/lib/puppet/application/agent.rb
+++ b/lib/puppet/application/agent.rb
@@ -54,7 +54,7 @@ class Puppet::Application::Agent < Puppet::Application
if Puppet::Network::Handler.handler(arg)
options[:serve] << arg.to_sym
else
- raise "Could not find handler for %s" % arg
+ raise "Could not find handler for #{arg}"
end
end
@@ -138,7 +138,7 @@ class Puppet::Application::Agent < Puppet::Application
end
def main
- Puppet.notice "Starting Puppet client version %s" % [Puppet.version]
+ Puppet.notice "Starting Puppet client version #{Puppet.version}"
@daemon.start
end
@@ -183,7 +183,7 @@ class Puppet::Application::Agent < Puppet::Application
def setup_listen
unless FileTest.exists?(Puppet[:authconfig])
- Puppet.err "Will not start without authorization file %s" % Puppet[:authconfig]
+ Puppet.err "Will not start without authorization file #{Puppet[:authconfig]}"
exit(14)
end
diff --git a/lib/puppet/application/apply.rb b/lib/puppet/application/apply.rb
index 1814858b0..07ce36736 100644
--- a/lib/puppet/application/apply.rb
+++ b/lib/puppet/application/apply.rb
@@ -49,7 +49,7 @@ class Puppet::Application::Apply < Puppet::Application
catalog = Puppet::Resource::Catalog.pson_create(catalog)
end
rescue => detail
- raise Puppet::Error, "Could not deserialize catalog from pson: %s" % detail
+ raise Puppet::Error, "Could not deserialize catalog from pson: #{detail}"
end
catalog = catalog.to_ral
@@ -85,12 +85,12 @@ class Puppet::Application::Apply < Puppet::Application
# Collect our facts.
unless facts = Puppet::Node::Facts.find(Puppet[:certname])
- raise "Could not find facts for %s" % Puppet[:certname]
+ raise "Could not find facts for #{Puppet[:certname]}"
end
# Find our Node
unless node = Puppet::Node.find(Puppet[:certname])
- raise "Could not find node %s" % Puppet[:certname]
+ raise "Could not find node #{Puppet[:certname]}"
end
# Merge in the facts.
@@ -101,7 +101,7 @@ class Puppet::Application::Apply < Puppet::Application
file = Puppet[:classfile]
if FileTest.exists?(file)
unless FileTest.readable?(file)
- $stderr.puts "%s is not readable" % file
+ $stderr.puts "#{file} is not readable"
exit(63)
end
node.classes = File.read(file).split(/[\s\n]+/)
diff --git a/lib/puppet/application/cert.rb b/lib/puppet/application/cert.rb
index b2b788201..a85f6a02b 100644
--- a/lib/puppet/application/cert.rb
+++ b/lib/puppet/application/cert.rb
@@ -36,7 +36,7 @@ class Puppet::Application::Cert < Puppet::Application
require 'puppet/ssl/certificate_authority/interface'
Puppet::SSL::CertificateAuthority::Interface::INTERFACE_METHODS.reject {|m| m == :destroy }.each do |method|
- option("--#{method}", "-%s" % method.to_s[0,1] ) do
+ option("--#{method}", "-#{method.to_s[0,1]}") do
find_mode("--#{method}")
end
end
diff --git a/lib/puppet/application/describe.rb b/lib/puppet/application/describe.rb
index b9c05c0e5..e696f1613 100644
--- a/lib/puppet/application/describe.rb
+++ b/lib/puppet/application/describe.rb
@@ -25,7 +25,7 @@ class Formatter
end
end
res << work if work.length.nonzero?
- return prefix + res.join("\n" + prefix)
+ return prefix + res.join("\n#{prefix}")
end
def header(txt, sep = "-")
@@ -133,7 +133,7 @@ class TypeDoc
docs.sort { |a,b|
a[0].to_s <=> b[0].to_s
}.each { |name, doc|
- print "\n- **%s**" % name
+ print "\n- **#{name}**"
if type.namevar == name and name != :name
puts " (*namevar*)"
else
@@ -159,7 +159,7 @@ class TypeDoc
type.providers.sort { |a,b|
a.to_s <=> b.to_s
}.each { |prov|
- puts "\n- **%s**" % prov
+ puts "\n- **#{prov}**"
puts @format.wrap(type.provider(prov).doc, :indent => 4, :scrub => true)
}
end
diff --git a/lib/puppet/application/doc.rb b/lib/puppet/application/doc.rb
index ae4c871cd..8dd116233 100644
--- a/lib/puppet/application/doc.rb
+++ b/lib/puppet/application/doc.rb
@@ -22,12 +22,12 @@ class Puppet::Application::Doc < Puppet::Application
option("--charset CHARSET")
option("--format FORMAT", "-f") do |arg|
- method = "to_%s" % arg
+ method = "to_#{arg}"
require 'puppet/util/reference'
if Puppet::Util::Reference.method_defined?(method)
options[:format] = method
else
- raise "Invalid output format %s" % arg
+ raise "Invalid output format #{arg}"
end
end
@@ -36,7 +36,7 @@ class Puppet::Application::Doc < Puppet::Application
if Puppet::Util::Reference.modes.include?(arg) or arg.intern==:rdoc
options[:mode] = arg.intern
else
- raise "Invalid output mode %s" % arg
+ raise "Invalid output mode #{arg}"
end
end
@@ -69,7 +69,7 @@ class Puppet::Application::Doc < Puppet::Application
files << File.dirname(env[:manifest])
end
files += command_line.args
- Puppet.info "scanning: %s" % files.inspect
+ Puppet.info "scanning: #{files.inspect}"
Puppet.settings.setdefaults(
"puppetdoc",
@@ -89,7 +89,7 @@ class Puppet::Application::Doc < Puppet::Application
if Puppet[:trace]
puts detail.backtrace
end
- $stderr.puts "Could not generate documentation: %s" % detail
+ $stderr.puts "Could not generate documentation: #{detail}"
exit_code = 1
end
exit exit_code
@@ -98,7 +98,7 @@ class Puppet::Application::Doc < Puppet::Application
def trac
require 'puppet/util/reference'
options[:references].each do |name|
- section = Puppet::Util::Reference.reference(name) or raise "Could not find section %s" % name
+ section = Puppet::Util::Reference.reference(name) or raise "Could not find section #{name}"
unless options[:mode] == :pdf
section.trac
end
@@ -111,7 +111,7 @@ class Puppet::Application::Doc < Puppet::Application
exit_code = 0
require 'puppet/util/reference'
options[:references].sort { |a,b| a.to_s <=> b.to_s }.each do |name|
- raise "Could not find reference %s" % name unless section = Puppet::Util::Reference.reference(name)
+ raise "Could not find reference #{name}" unless section = Puppet::Util::Reference.reference(name)
begin
# Add the per-section text, but with no ToC
@@ -122,7 +122,7 @@ class Puppet::Application::Doc < Puppet::Application
text = ""
rescue => detail
puts detail.backtrace
- $stderr.puts "Could not generate reference %s: %s" % [name, detail]
+ $stderr.puts "Could not generate reference #{name}: #{detail}"
exit_code = 1
next
end
@@ -141,14 +141,14 @@ class Puppet::Application::Doc < Puppet::Application
exit_code = 0
require 'puppet/util/reference'
options[:references].sort { |a,b| a.to_s <=> b.to_s }.each do |name|
- raise "Could not find reference %s" % name unless section = Puppet::Util::Reference.reference(name)
+ raise "Could not find reference #{name}" unless section = Puppet::Util::Reference.reference(name)
begin
# Add the per-section text, but with no ToC
text += section.send(options[:format], with_contents)
rescue => detail
puts detail.backtrace
- $stderr.puts "Could not generate reference %s: %s" % [name, detail]
+ $stderr.puts "Could not generate reference #{name}: #{detail}"
exit_code = 1
next
end
diff --git a/lib/puppet/application/filebucket.rb b/lib/puppet/application/filebucket.rb
index 842e172c1..095a413a7 100644
--- a/lib/puppet/application/filebucket.rb
+++ b/lib/puppet/application/filebucket.rb
@@ -28,15 +28,15 @@ class Puppet::Application::Filebucket < Puppet::Application
def backup
args.each do |file|
unless FileTest.exists?(file)
- $stderr.puts "%s: no such file" % file
+ $stderr.puts "#{file}: no such file"
next
end
unless FileTest.readable?(file)
- $stderr.puts "%s: cannot read file" % file
+ $stderr.puts "#{file}: cannot read file"
next
end
md5 = @client.backup(file)
- puts "%s: %s" % [file, md5]
+ puts "#{file}: #{md5}"
end
end
diff --git a/lib/puppet/application/kick.rb b/lib/puppet/application/kick.rb
index e6cbed6c8..eaafc0935 100644
--- a/lib/puppet/application/kick.rb
+++ b/lib/puppet/application/kick.rb
@@ -32,7 +32,7 @@ class Puppet::Application::Kick < Puppet::Application
begin
options[:parallel] = Integer(arg)
rescue
- $stderr.puts "Could not convert %s to an integer" % arg.inspect
+ $stderr.puts "Could not convert #{arg.inspect} to an integer"
exit(23)
end
end
@@ -80,9 +80,9 @@ class Puppet::Application::Kick < Puppet::Application
if $CHILD_STATUS.exitstatus != 0
failures << host
end
- print "%s finished with exit code %s\n" % [host, $CHILD_STATUS.exitstatus]
+ print "#{host} finished with exit code #{$CHILD_STATUS.exitstatus}\n"
else
- $stderr.puts "Could not find host for PID %s with status %s" % [pid, $CHILD_STATUS.exitstatus]
+ $stderr.puts "Could not find host for PID #{pid} with status #{$CHILD_STATUS.exitstatus}"
end
rescue Errno::ECHILD
# There are no children left, so just exit unless there are still
@@ -93,7 +93,7 @@ class Puppet::Application::Kick < Puppet::Application
puts "Finished"
exit(0)
else
- puts "Failed: %s" % failures.join(", ")
+ puts "Failed: #{failures.join(", ")}"
exit(3)
end
end
@@ -105,7 +105,7 @@ class Puppet::Application::Kick < Puppet::Application
if options[:ping]
out = %x{ping -c 1 #{host}}
unless $CHILD_STATUS == 0
- $stderr.print "Could not contact %s\n" % host
+ $stderr.print "Could not contact #{host}\n"
next
end
end
@@ -115,7 +115,7 @@ class Puppet::Application::Kick < Puppet::Application
port = Puppet[:puppetport]
url = ["https://#{host}:#{port}", "production", "run", host].join('/')
- print "Triggering %s\n" % host
+ print "Triggering #{host}\n"
begin
run_options = {
:tags => @tags,
@@ -128,7 +128,7 @@ class Puppet::Application::Kick < Puppet::Application
puts "status is #{result}"
rescue => detail
puts detail.backtrace if Puppet[:trace]
- $stderr.puts "Host %s failed: %s\n" % [host, detail]
+ $stderr.puts "Host #{host} failed: #{detail}\n"
exit(2)
end
@@ -136,10 +136,10 @@ class Puppet::Application::Kick < Puppet::Application
when "success";
exit(0)
when "running"
- $stderr.puts "Host %s is already running" % host
+ $stderr.puts "Host #{host} is already running"
exit(3)
else
- $stderr.puts "Host %s returned unknown answer '%s'" % [host, result]
+ $stderr.puts "Host #{host} returned unknown answer '#{result}'"
exit(12)
end
end
@@ -178,12 +178,12 @@ class Puppet::Application::Kick < Puppet::Application
if Puppet[:node_terminus] == "ldap" and (options[:all] or @classes)
if options[:all]
@hosts = Puppet::Node.search("whatever", :fqdn => options[:fqdn]).collect { |node| node.name }
- puts "all: %s" % @hosts.join(", ")
+ puts "all: #{@hosts.join(", ")}"
else
@hosts = []
@classes.each do |klass|
list = Puppet::Node.search("whatever", :fqdn => options[:fqdn], :class => klass).collect { |node| node.name }
- puts "%s: %s" % [klass, list.join(", ")]
+ puts "#{klass}: #{list.join(", ")}"
@hosts += list
end
diff --git a/lib/puppet/application/master.rb b/lib/puppet/application/master.rb
index a8ed27c42..7ea3f3a83 100644
--- a/lib/puppet/application/master.rb
+++ b/lib/puppet/application/master.rb
@@ -54,7 +54,7 @@ class Puppet::Application::Master < Puppet::Application
raise ArgumentError, "Cannot render compiled catalogs without pson support" unless Puppet.features.pson?
begin
unless catalog = Puppet::Resource::Catalog.find(options[:node])
- raise "Could not compile catalog for %s" % options[:node]
+ raise "Could not compile catalog for #{options[:node]}"
end
jj catalog.to_resource
@@ -100,7 +100,7 @@ class Puppet::Application::Master < Puppet::Application
Puppet::Util.chuser
rescue => detail
puts detail.backtrace if Puppet[:trace]
- $stderr.puts "Could not change user to %s: %s" % [Puppet[:user], detail]
+ $stderr.puts "Could not change user to #{Puppet[:user]}: #{detail}"
exit(39)
end
end
@@ -114,7 +114,7 @@ class Puppet::Application::Master < Puppet::Application
@app = Puppet::Network::HTTP::Rack.new(:xmlrpc_handlers => xmlrpc_handlers, :protocols => [:rest, :xmlrpc])
end
- Puppet.notice "Starting Puppet master version %s" % [Puppet.version]
+ Puppet.notice "Starting Puppet master version #{Puppet.version}"
unless options[:rack]
@daemon.start
diff --git a/lib/puppet/application/queue.rb b/lib/puppet/application/queue.rb
index ce5323505..8e830b39e 100644
--- a/lib/puppet/application/queue.rb
+++ b/lib/puppet/application/queue.rb
@@ -38,17 +38,17 @@ class Puppet::Application::Queue < Puppet::Application
option("--verbose","-v")
def main
- Puppet.notice "Starting puppetqd %s" % Puppet.version
+ Puppet.notice "Starting puppetqd #{Puppet.version}"
Puppet::Resource::Catalog::Queue.subscribe do |catalog|
# Once you have a Puppet::Resource::Catalog instance, calling save() on it should suffice
# to put it through to the database via its active_record indirector (which is determined
# by the terminus_class = :active_record setting above)
- Puppet::Util.benchmark(:notice, "Processing queued catalog for %s" % catalog.name) do
+ Puppet::Util.benchmark(:notice, "Processing queued catalog for #{catalog.name}") do
begin
catalog.save
rescue => detail
puts detail.backtrace if Puppet[:trace]
- Puppet.err "Could not save queued catalog for %s: %s" % [catalog.name, detail]
+ Puppet.err "Could not save queued catalog for #{catalog.name}: #{detail}"
end
end
end
diff --git a/lib/puppet/application/resource.rb b/lib/puppet/application/resource.rb
index df18cb5c7..a6cc99302 100644
--- a/lib/puppet/application/resource.rb
+++ b/lib/puppet/application/resource.rb
@@ -45,7 +45,7 @@ class Puppet::Application::Resource < Puppet::Application
if setting =~ /^(\w+)=(.+)$/
params[$1] = $2
else
- raise "Invalid parameter setting %s" % setting
+ raise "Invalid parameter setting #{setting}"
end
end
@@ -96,7 +96,7 @@ class Puppet::Application::Resource < Puppet::Application
end
ENV["EDITOR"] ||= "vi"
system(ENV["EDITOR"], file)
- system("puppet -v " + file)
+ system("puppet -v #{file}")
ensure
#if FileTest.exists? file
# File.unlink(file)
diff --git a/lib/puppet/configurer.rb b/lib/puppet/configurer.rb
index dc2b99cfe..832205f5f 100644
--- a/lib/puppet/configurer.rb
+++ b/lib/puppet/configurer.rb
@@ -57,12 +57,12 @@ class Puppet::Configurer
if Puppet[:trace]
puts detail.backtrace
end
- Puppet.err "Corrupt state file %s: %s" % [Puppet[:statefile], detail]
+ Puppet.err "Corrupt state file #{Puppet[:statefile]}: #{detail}"
begin
::File.unlink(Puppet[:statefile])
retry
rescue => detail
- raise Puppet::Error.new("Cannot remove %s: %s" % [Puppet[:statefile], detail])
+ raise Puppet::Error.new("Cannot remove #{Puppet[:statefile]}: #{detail}")
end
end
end
@@ -135,7 +135,7 @@ class Puppet::Configurer
raise
rescue Exception => detail
puts detail.backtrace if Puppet[:trace]
- Puppet.err "Failed to prepare catalog: %s" % detail
+ Puppet.err "Failed to prepare catalog: #{detail}"
end
options[:report] ||= initialize_report()
@@ -158,7 +158,7 @@ class Puppet::Configurer
report
rescue => detail
puts detail.backtrace if Puppet[:trace]
- Puppet.err "Failed to apply catalog: %s" % detail
+ Puppet.err "Failed to apply catalog: #{detail}"
return
end
ensure
@@ -219,7 +219,7 @@ class Puppet::Configurer
result
rescue => detail
puts detail.backtrace if Puppet[:trace]
- Puppet.err "Could not retrieve catalog from cache: %s" % detail
+ Puppet.err "Could not retrieve catalog from cache: #{detail}"
return nil
end
@@ -233,7 +233,7 @@ class Puppet::Configurer
raise
rescue Exception => detail
puts detail.backtrace if Puppet[:trace]
- Puppet.err "Could not retrieve catalog from remote server: %s" % detail
+ Puppet.err "Could not retrieve catalog from remote server: #{detail}"
return nil
end
end
diff --git a/lib/puppet/configurer/downloader.rb b/lib/puppet/configurer/downloader.rb
index 7409fca64..5daea295b 100644
--- a/lib/puppet/configurer/downloader.rb
+++ b/lib/puppet/configurer/downloader.rb
@@ -38,7 +38,7 @@ class Puppet::Configurer::Downloader
end
rescue Puppet::Error, Timeout::Error => detail
puts detail.backtrace if Puppet[:debug]
- Puppet.err "Could not retrieve #{name}: %s" % detail
+ Puppet.err "Could not retrieve #{name}: #{detail}"
end
return files
diff --git a/lib/puppet/configurer/fact_handler.rb b/lib/puppet/configurer/fact_handler.rb
index 5ff202002..9710681d4 100644
--- a/lib/puppet/configurer/fact_handler.rb
+++ b/lib/puppet/configurer/fact_handler.rb
@@ -21,7 +21,7 @@ module Puppet::Configurer::FactHandler
raise
rescue Exception => detail
puts detail.backtrace if Puppet[:trace]
- raise Puppet::Error, "Could not retrieve local facts: %s" % detail
+ raise Puppet::Error, "Could not retrieve local facts: #{detail}"
end
end
diff --git a/lib/puppet/configurer/plugin_handler.rb b/lib/puppet/configurer/plugin_handler.rb
index 9e1c113f9..98c8de367 100644
--- a/lib/puppet/configurer/plugin_handler.rb
+++ b/lib/puppet/configurer/plugin_handler.rb
@@ -17,12 +17,12 @@ module Puppet::Configurer::PluginHandler
return if FileTest.directory?(file)
begin
- Puppet.info "Loading downloaded plugin %s" % file
+ Puppet.info "Loading downloaded plugin #{file}"
load file
rescue SystemExit,NoMemoryError
raise
rescue Exception => detail
- Puppet.err "Could not load downloaded file %s: %s" % [file, detail]
+ Puppet.err "Could not load downloaded file #{file}: #{detail}"
end
end
end
diff --git a/lib/puppet/daemon.rb b/lib/puppet/daemon.rb
index 5d5c4631f..ed06ea6c8 100755
--- a/lib/puppet/daemon.rb
+++ b/lib/puppet/daemon.rb
@@ -32,9 +32,9 @@ class Puppet::Daemon
$stderr.reopen $stdout
Puppet::Util::Log.reopen
rescue => detail
- Puppet.err "Could not start %s: %s" % [Puppet[:name], detail]
+ Puppet.err "Could not start #{Puppet[:name]}: #{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}"
}
exit(12)
end
@@ -45,7 +45,7 @@ class Puppet::Daemon
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
@@ -58,7 +58,7 @@ class Puppet::Daemon
def reexec
raise Puppet::DevError, "Cannot reexec unless ARGV arguments are set" unless argv
command = $0 + " " + argv.join(" ")
- Puppet.notice "Restarting with '%s'" % command
+ Puppet.notice "Restarting with '#{command}'"
stop(:exit => false)
exec(command)
end
@@ -78,7 +78,7 @@ class Puppet::Daemon
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
diff --git a/lib/puppet/error.rb b/lib/puppet/error.rb
index 66c4f19a6..040a6c4b2 100644
--- a/lib/puppet/error.rb
+++ b/lib/puppet/error.rb
@@ -23,11 +23,11 @@ module Puppet # :nodoc:
def to_s
str = nil
if self.file and self.line
- str = "%s at %s:%s" % [@message.to_s, @file, @line]
+ str = "#{@message} at #{@file}:#{@line}"
elsif self.line
- str = "%s at line %s" % [@message.to_s, @line]
+ str = "#{@message} at line #{@line}"
elsif self.file
- str = "%s in %s" % [@message.to_s, self.file]
+ str = "#{@message} in #{self.file}"
else
str = @message.to_s
end
diff --git a/lib/puppet/external/dot.rb b/lib/puppet/external/dot.rb
index b0d542891..77d66e92e 100644
--- a/lib/puppet/external/dot.rb
+++ b/lib/puppet/external/dot.rb
@@ -311,7 +311,7 @@ module DOT
i[1] && i[0] != 'label' ?
t + $tab + "#{i[0]} = #{i[1]}" :
i[1] ? t + $tab + "#{i[0]} = \"#{i[1]}\"" : nil
- }.compact.join( "\n" ) + "\n" + t + "]\n"
+ }.compact.join( "\n" ) + "\n#{t}]\n"
end
end # class DOTEdge
diff --git a/lib/puppet/external/nagios/base.rb b/lib/puppet/external/nagios/base.rb
index 1b49459a4..d3766e6f5 100755
--- a/lib/puppet/external/nagios/base.rb
+++ b/lib/puppet/external/nagios/base.rb
@@ -32,7 +32,7 @@ class Nagios::Base
# Uncamelcase a parameter.
def self.decamelcase(param)
param.gsub(/[A-Z]/) do |match|
- "_" + match.downcase
+ "_#{match.downcase}"
end
end
@@ -43,7 +43,7 @@ class Nagios::Base
if @types.include?(name)
@types[name].new(args)
else
- raise UnknownNagiosType, "Unknown type %s" % name
+ raise UnknownNagiosType, "Unknown type #{name}"
end
end
@@ -81,7 +81,7 @@ class Nagios::Base
@namevar = tmp
return @namevar
else
- raise "Type %s has no name var" % self.name
+ raise "Type #{self.name} has no name var"
end
end
end
@@ -287,14 +287,14 @@ class Nagios::Base
oc.sub!(/::/,'')
ocs.push oc
ocs.each { |oc|
- str += "objectclass: " + oc + "\n"
+ str += "objectclass: #{oc}\n"
}
@parameters.each { |name,value|
if self.class.suppress.include?(name)
next
end
ldapname = self.parammap(name)
- str += ldapname + ": " + value + "\n"
+ str += ldapname + ": #{value}\n"
}
str += "\n"
str
diff --git a/lib/puppet/external/nagios/parser.rb b/lib/puppet/external/nagios/parser.rb
index 4a1f4c98d..80b912bc0 100644
--- a/lib/puppet/external/nagios/parser.rb
+++ b/lib/puppet/external/nagios/parser.rb
@@ -537,10 +537,10 @@ def token
if yytext =~ /\W/
giveback = yytext.dup
giveback.sub!(/^\w+/,'')
- #puts "giveback " + giveback
- #puts "yytext " + yytext
+ #puts "giveback #{giveback}"
+ #puts "yytext #{yytext}"
yytext.sub!(/\W.*$/,'')
- #puts "yytext " + yytext
+ #puts "yytext #{yytext}"
#puts "all [#{giveback} #{yytext} #{orig}]"
@src = giveback + @src
end
diff --git a/lib/puppet/file_bucket/dipper.rb b/lib/puppet/file_bucket/dipper.rb
index d9239e865..714f4f9cd 100644
--- a/lib/puppet/file_bucket/dipper.rb
+++ b/lib/puppet/file_bucket/dipper.rb
@@ -31,7 +31,7 @@ class Puppet::FileBucket::Dipper
# Back up a file to our bucket
def backup(file)
unless ::File.exist?(file)
- raise(ArgumentError, "File %s does not exist" % file)
+ raise(ArgumentError, "File #{file} does not exist")
end
contents = ::File.read(file)
begin
@@ -42,7 +42,7 @@ class Puppet::FileBucket::Dipper
return file_bucket_file.checksum_data
rescue => detail
puts detail.backtrace if Puppet[:trace]
- raise Puppet::Error, "Could not back up %s: %s" % [file, detail]
+ raise Puppet::Error, "Could not back up #{file}: #{detail}"
end
end
@@ -84,7 +84,7 @@ class Puppet::FileBucket::Dipper
::File.chmod(changed, file)
end
else
- Puppet.err "Could not find file with checksum %s" % sum
+ Puppet.err "Could not find file with checksum #{sum}"
return nil
end
return newsum
diff --git a/lib/puppet/file_serving/base.rb b/lib/puppet/file_serving/base.rb
index 3543df8d7..8e55f742a 100644
--- a/lib/puppet/file_serving/base.rb
+++ b/lib/puppet/file_serving/base.rb
@@ -38,7 +38,7 @@ class Puppet::FileServing::Base
begin
send param.to_s + "=", value
rescue NoMethodError
- raise ArgumentError, "Invalid option %s for %s" % [param, self.class]
+ raise ArgumentError, "Invalid option #{param} for #{self.class}"
end
end
end
diff --git a/lib/puppet/file_serving/configuration.rb b/lib/puppet/file_serving/configuration.rb
index 9034caed1..69b1f9329 100644
--- a/lib/puppet/file_serving/configuration.rb
+++ b/lib/puppet/file_serving/configuration.rb
@@ -41,7 +41,7 @@ class Puppet::FileServing::Configuration
end
if environment.module(mount_name)
- Puppet::Util::Warnings.notice_once "DEPRECATION NOTICE: Files found in modules without specifying 'modules' in file path will be deprecated in the next major release. Please fix module '%s' when no 0.24.x clients are present" % mount_name
+ Puppet::Util::Warnings.notice_once "DEPRECATION NOTICE: Files found in modules without specifying 'modules' in file path will be deprecated in the next major release. Please fix module '#{mount_name}' when no 0.24.x clients are present"
return mounts["modules"]
end
@@ -70,12 +70,12 @@ class Puppet::FileServing::Configuration
mount_name, path = request.key.split(File::Separator, 2)
- raise(ArgumentError, "Cannot find file: Invalid path '%s'" % mount_name) unless mount_name =~ %r{^[-\w]+$}
+ raise(ArgumentError, "Cannot find file: Invalid path '#{mount_name}'") unless mount_name =~ %r{^[-\w]+$}
return nil unless mount = find_mount(mount_name, request.environment)
if mount.name == "modules" and mount_name != "modules"
# yay backward-compatibility
- path = "%s/%s" % [mount_name, path]
+ path = "#{mount_name}/#{path}"
end
if path == ""
@@ -119,7 +119,7 @@ class Puppet::FileServing::Configuration
@mounts = newmounts
rescue => detail
puts detail.backtrace if Puppet[:trace]
- Puppet.err "Error parsing fileserver configuration: %s; using old configuration" % detail
+ Puppet.err "Error parsing fileserver configuration: #{detail}; using old configuration"
end
ensure
diff --git a/lib/puppet/file_serving/configuration/parser.rb b/lib/puppet/file_serving/configuration/parser.rb
index d8bf30477..f40a554e3 100644
--- a/lib/puppet/file_serving/configuration/parser.rb
+++ b/lib/puppet/file_serving/configuration/parser.rb
@@ -7,8 +7,8 @@ class Puppet::FileServing::Configuration::Parser < Puppet::Util::LoadedFile
# Parse our configuration file.
def parse
- raise("File server configuration %s does not exist" % self.file) unless FileTest.exists?(self.file)
- raise("Cannot read file server configuration %s" % self.file) unless FileTest.readable?(self.file)
+ raise("File server configuration #{self.file} does not exist") unless FileTest.exists?(self.file)
+ raise("Cannot read file server configuration #{self.file}") unless FileTest.readable?(self.file)
@mounts = {}
@count = 0
@@ -36,10 +36,10 @@ class Puppet::FileServing::Configuration::Parser < Puppet::Util::LoadedFile
when "deny"
deny(mount, value)
else
- raise ArgumentError.new("Invalid argument '%s'" % var, @count, file)
+ raise ArgumentError.new("Invalid argument '#{var}'", @count, file)
end
else
- raise ArgumentError.new("Invalid line '%s'" % line.chomp, @count, file)
+ raise ArgumentError.new("Invalid line '#{line.chomp}'", @count, file)
end
}
}
@@ -56,7 +56,7 @@ class Puppet::FileServing::Configuration::Parser < Puppet::Util::LoadedFile
# LAK:NOTE See http://snurl.com/21zf8 [groups_google_com]
x = value.split(/\s*,\s*/).each { |val|
begin
- mount.info "allowing %s access" % val
+ mount.info "allowing #{val} access"
mount.allow(val)
rescue AuthStoreError => detail
@@ -73,7 +73,7 @@ class Puppet::FileServing::Configuration::Parser < Puppet::Util::LoadedFile
# LAK:NOTE See http://snurl.com/21zf8 [groups_google_com]
x = value.split(/\s*,\s*/).each { |val|
begin
- mount.info "denying %s access" % val
+ mount.info "denying #{val} access"
mount.deny(val)
rescue AuthStoreError => detail
@@ -88,7 +88,7 @@ class Puppet::FileServing::Configuration::Parser < Puppet::Util::LoadedFile
# Create a new mount.
def newmount(name)
if @mounts.include?(name)
- raise ArgumentError, "%s is already mounted at %s" % [@mounts[name], name], @count, file
+ raise ArgumentError, "#{@mounts[name]} is already mounted at #{name}", @count, file
end
case name
when "modules"
@@ -108,7 +108,7 @@ class Puppet::FileServing::Configuration::Parser < Puppet::Util::LoadedFile
begin
mount.path = value
rescue ArgumentError => detail
- Puppet.err "Removing mount %s: %s" % [mount.name, detail]
+ Puppet.err "Removing mount #{mount.name}: #{detail}"
@mounts.delete(mount.name)
end
else
diff --git a/lib/puppet/file_serving/fileset.rb b/lib/puppet/file_serving/fileset.rb
index 41765164e..4155685d6 100644
--- a/lib/puppet/file_serving/fileset.rb
+++ b/lib/puppet/file_serving/fileset.rb
@@ -81,7 +81,7 @@ class Puppet::FileServing::Fileset
def links=(links)
links = links.to_sym
- raise(ArgumentError, "Invalid :links value '%s'" % links) unless [:manage, :follow].include?(links)
+ raise(ArgumentError, "Invalid :links value '#{links}'") unless [:manage, :follow].include?(links)
@links = links
@stat_method = links == :manage ? :lstat : :stat
end
@@ -99,7 +99,7 @@ class Puppet::FileServing::Fileset
begin
send(method, value)
rescue NoMethodError
- raise ArgumentError, "Invalid option '%s'" % option
+ raise ArgumentError, "Invalid option '#{option}'"
end
end
end
diff --git a/lib/puppet/file_serving/indirection_hooks.rb b/lib/puppet/file_serving/indirection_hooks.rb
index 5fd7985e7..d1219f0c1 100644
--- a/lib/puppet/file_serving/indirection_hooks.rb
+++ b/lib/puppet/file_serving/indirection_hooks.rb
@@ -25,7 +25,7 @@ module Puppet::FileServing::IndirectionHooks
end
if request.protocol and PROTOCOL_MAP[request.protocol].nil?
- raise(ArgumentError, "URI protocol '%s' is not currently supported for file serving" % request.protocol)
+ raise(ArgumentError, "URI protocol '#{request.protocol}' is not currently supported for file serving")
end
# If we're still here, we're using the file_server or modules.
diff --git a/lib/puppet/file_serving/metadata.rb b/lib/puppet/file_serving/metadata.rb
index 848a5f963..697de1055 100644
--- a/lib/puppet/file_serving/metadata.rb
+++ b/lib/puppet/file_serving/metadata.rb
@@ -36,7 +36,7 @@ class Puppet::FileServing::Metadata < Puppet::FileServing::Base
end
def checksum_type=(type)
- raise(ArgumentError, "Unsupported checksum type %s" % type) unless respond_to?("%s_file" % type)
+ raise(ArgumentError, "Unsupported checksum type #{type}") unless respond_to?("#{type}_file")
@checksum_type = type
end
@@ -57,15 +57,15 @@ class Puppet::FileServing::Metadata < Puppet::FileServing::Base
case stat.ftype
when "file"
- @checksum = ("{%s}" % @checksum_type) + send("%s_file" % @checksum_type, real_path).to_s
+ @checksum = ("{#{@checksum_type}}") + send("#{@checksum_type}_file", real_path).to_s
when "directory" # Always just timestamp the directory.
@checksum_type = "ctime"
- @checksum = ("{%s}" % @checksum_type) + send("%s_file" % @checksum_type, path).to_s
+ @checksum = ("{#{@checksum_type}}") + send("#{@checksum_type}_file", path).to_s
when "link"
@destination = File.readlink(real_path)
- @checksum = ("{%s}" % @checksum_type) + send("%s_file" % @checksum_type, real_path).to_s rescue nil
+ @checksum = ("{#{@checksum_type}}") + send("#{@checksum_type}_file", real_path).to_s rescue nil
else
- raise ArgumentError, "Cannot manage files of type %s" % stat.ftype
+ raise ArgumentError, "Cannot manage files of type #{stat.ftype}"
end
end
diff --git a/lib/puppet/file_serving/mount.rb b/lib/puppet/file_serving/mount.rb
index 7ee11a99b..420b6f73e 100644
--- a/lib/puppet/file_serving/mount.rb
+++ b/lib/puppet/file_serving/mount.rb
@@ -23,7 +23,7 @@ class Puppet::FileServing::Mount < Puppet::Network::AuthStore
# Create our object. It must have a name.
def initialize(name)
unless name =~ %r{^[-\w]+$}
- raise ArgumentError, "Invalid mount name format '%s'" % name
+ raise ArgumentError, "Invalid mount name format '#{name}'"
end
@name = name
@@ -35,7 +35,7 @@ class Puppet::FileServing::Mount < Puppet::Network::AuthStore
end
def to_s
- "mount[%s]" % @name
+ "mount[#{@name}]"
end
# A noop.
diff --git a/lib/puppet/file_serving/mount/file.rb b/lib/puppet/file_serving/mount/file.rb
index 8a619e962..c876cc2c0 100644
--- a/lib/puppet/file_serving/mount/file.rb
+++ b/lib/puppet/file_serving/mount/file.rb
@@ -56,10 +56,10 @@ class Puppet::FileServing::Mount::File < Puppet::FileServing::Mount
@expandable = true
else
unless FileTest.directory?(path)
- raise ArgumentError, "%s does not exist or is not a directory" % path
+ raise ArgumentError, "#{path} does not exist or is not a directory"
end
unless FileTest.readable?(path)
- raise ArgumentError, "%s is not readable" % path
+ raise ArgumentError, "#{path} is not readable"
end
@expandable = false
end
@@ -96,7 +96,7 @@ class Puppet::FileServing::Mount::File < Puppet::FileServing::Mount
if node
map = clientmap(node)
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
diff --git a/lib/puppet/indirector.rb b/lib/puppet/indirector.rb
index 4f56b2fc4..97892d99a 100644
--- a/lib/puppet/indirector.rb
+++ b/lib/puppet/indirector.rb
@@ -18,7 +18,7 @@ module Puppet::Indirector
# evaluated at parse time, which is before the user has had a chance
# to override it.
def indirects(indirection, options = {})
- raise(ArgumentError, "Already handling indirection for %s; cannot also handle %s" % [@indirection.name, indirection]) if defined?(@indirection) and @indirection
+ raise(ArgumentError, "Already handling indirection for #{@indirection.name}; cannot also handle #{indirection}") if defined?(@indirection) and @indirection
# populate this class with the various new methods
extend ClassMethods
include InstanceMethods
diff --git a/lib/puppet/indirector/catalog/compiler.rb b/lib/puppet/indirector/catalog/compiler.rb
index b1c9df7c4..a689eff2d 100644
--- a/lib/puppet/indirector/catalog/compiler.rb
+++ b/lib/puppet/indirector/catalog/compiler.rb
@@ -13,7 +13,7 @@ class Puppet::Resource::Catalog::Compiler < Puppet::Indirector::Code
def extract_facts_from_request(request)
return unless text_facts = request.options[:facts]
- raise ArgumentError, "Facts but no fact format provided for %s" % request.name unless format = request.options[:facts_format]
+ raise ArgumentError, "Facts but no fact format provided for #{request.name}" unless format = request.options[:facts_format]
# If the facts were encoded as yaml, then the param reconstitution system
# in Network::HTTP::Handler will automagically deserialize the value.
@@ -66,15 +66,15 @@ class Puppet::Resource::Catalog::Compiler < Puppet::Indirector::Code
# Compile the actual catalog.
def compile(node)
- str = "Compiled catalog for %s" % node.name
+ str = "Compiled catalog for #{node.name}"
if node.environment
- str += " in environment %s" % node.environment
+ str += " in environment #{node.environment}"
end
config = nil
loglevel = networked? ? :notice : :none
- benchmark(loglevel, "Compiled catalog for %s" % node.name) do
+ benchmark(loglevel, "Compiled catalog for #{node.name}") do
begin
return Puppet::Parser::Compiler.compile(node)
rescue Puppet::Error => detail
@@ -92,7 +92,7 @@ class Puppet::Resource::Catalog::Compiler < Puppet::Indirector::Code
return nil unless node = Puppet::Node.find(name)
rescue => detail
puts detail.backtrace if Puppet[:trace]
- raise Puppet::Error, "Failed when searching for node %s: %s" % [name, detail]
+ raise Puppet::Error, "Failed when searching for node #{name}: #{detail}"
end
@@ -117,7 +117,7 @@ class Puppet::Resource::Catalog::Compiler < Puppet::Indirector::Code
return node
end
- raise ArgumentError, "Could not find node '%s'; cannot compile" % name
+ raise ArgumentError, "Could not find node '#{name}'; cannot compile"
end
# Initialize our server fact hash; we add these to each client, and they
@@ -135,7 +135,7 @@ class Puppet::Resource::Catalog::Compiler < Puppet::Indirector::Code
if value = Facter.value(fact)
@server_facts[var] = value
else
- Puppet.warning "Could not retrieve fact %s" % fact
+ Puppet.warning "Could not retrieve fact #{fact}"
end
end
diff --git a/lib/puppet/indirector/certificate_request/ca.rb b/lib/puppet/indirector/certificate_request/ca.rb
index e90f43a03..25680fb9b 100644
--- a/lib/puppet/indirector/certificate_request/ca.rb
+++ b/lib/puppet/indirector/certificate_request/ca.rb
@@ -8,7 +8,7 @@ class Puppet::SSL::CertificateRequest::Ca < Puppet::Indirector::SslFile
def save(request)
result = super
- Puppet.notice "%s has a waiting certificate request" % request.key
+ Puppet.notice "#{request.key} has a waiting certificate request"
result
end
end
diff --git a/lib/puppet/indirector/exec.rb b/lib/puppet/indirector/exec.rb
index 022ec5324..f8d863562 100644
--- a/lib/puppet/indirector/exec.rb
+++ b/lib/puppet/indirector/exec.rb
@@ -39,12 +39,12 @@ class Puppet::Indirector::Exec < Puppet::Indirector::Terminus
begin
output = execute(external_command)
rescue Puppet::ExecutionFailure => detail
- Puppet.err "Failed to find %s via exec: %s" % [name, detail]
+ Puppet.err "Failed to find #{name} via exec: #{detail}"
return nil
end
if output =~ /\A\s*\Z/ # all whitespace
- Puppet.debug "Empty response for %s from exec %s terminus" % [name, self.name]
+ Puppet.debug "Empty response for #{name} from exec #{self.name} terminus"
return nil
else
return output
diff --git a/lib/puppet/indirector/facts/facter.rb b/lib/puppet/indirector/facts/facter.rb
index 9d181706c..e1d910247 100644
--- a/lib/puppet/indirector/facts/facter.rb
+++ b/lib/puppet/indirector/facts/facter.rb
@@ -11,7 +11,7 @@ class Puppet::Node::Facts::Facter < Puppet::Indirector::Code
# Add any per-module fact directories to the factpath
module_fact_dirs = Puppet[:modulepath].split(":").collect do |d|
["lib", "plugins"].map do |subdirectory|
- Dir.glob("%s/*/#{subdirectory}/facter" % d)
+ Dir.glob("#{d}/*/#{subdirectory}/facter")
end
end.flatten
dirs = module_fact_dirs + Puppet[:factpath].split(":")
@@ -27,14 +27,14 @@ class Puppet::Node::Facts::Facter < Puppet::Indirector::Code
Dir.glob("*.rb").each do |file|
fqfile = ::File.join(dir, file)
begin
- Puppet.info "Loading facts in %s" % [::File.basename(file.sub(".rb",''))]
+ Puppet.info "Loading facts in #{::File.basename(file.sub(".rb",''))}"
Timeout::timeout(self.timeout) do
load file
end
rescue SystemExit,NoMemoryError
raise
rescue Exception => detail
- Puppet.warning "Could not load fact file %s: %s" % [fqfile, detail]
+ Puppet.warning "Could not load fact file #{fqfile}: #{detail}"
end
end
end
diff --git a/lib/puppet/indirector/file.rb b/lib/puppet/indirector/file.rb
index a035f0dac..dab8fc720 100644
--- a/lib/puppet/indirector/file.rb
+++ b/lib/puppet/indirector/file.rb
@@ -14,7 +14,7 @@ class Puppet::Indirector::File < Puppet::Indirector::Terminus
end
def file_path(request)
- File.join(data_directory, request.key + "." + serialization_format)
+ File.join(data_directory, request.key + ".#{serialization_format}")
end
def latest_path(request)
diff --git a/lib/puppet/indirector/file_server.rb b/lib/puppet/indirector/file_server.rb
index 18ac20824..bf101d490 100644
--- a/lib/puppet/indirector/file_server.rb
+++ b/lib/puppet/indirector/file_server.rb
@@ -43,7 +43,7 @@ class Puppet::Indirector::FileServer < Puppet::Indirector::Terminus
mount, relative_path = configuration.split_path(request)
unless mount and paths = mount.search(relative_path, request)
- Puppet.info "Could not find filesystem info for file '%s' in environment %s" % [request.key, request.environment]
+ Puppet.info "Could not find filesystem info for file '#{request.key}' in environment #{request.environment}"
return nil
end
diff --git a/lib/puppet/indirector/indirection.rb b/lib/puppet/indirector/indirection.rb
index 85890f24c..95a022e38 100644
--- a/lib/puppet/indirector/indirection.rb
+++ b/lib/puppet/indirector/indirection.rb
@@ -84,7 +84,7 @@ class Puppet::Indirector::Indirection
end
if s = terminus_setting()
- text += "* **Terminus Setting**: %s" % terminus_setting
+ text += "* **Terminus Setting**: #{terminus_setting}"
end
text
@@ -97,7 +97,7 @@ class Puppet::Indirector::Indirection
@cache_class = nil
@terminus_class = nil
- raise(ArgumentError, "Indirection %s is already defined" % @name) if @@indirections.find { |i| i.name == @name }
+ raise(ArgumentError, "Indirection #{@name} is already defined") if @@indirections.find { |i| i.name == @name }
@@indirections << self
if mod = options[:extend]
@@ -110,7 +110,7 @@ class Puppet::Indirector::Indirection
begin
send(name.to_s + "=", value)
rescue NoMethodError
- raise ArgumentError, "%s is not a valid Indirection parameter" % name
+ raise ArgumentError, "#{name} is not a valid Indirection parameter"
end
end
end
@@ -124,7 +124,7 @@ class Puppet::Indirector::Indirection
def terminus(terminus_name = nil)
# Get the name of the terminus.
unless terminus_name ||= terminus_class
- raise Puppet::DevError, "No terminus specified for %s; cannot redirect" % self.name
+ raise Puppet::DevError, "No terminus specified for #{self.name}; cannot redirect"
end
return termini[terminus_name] ||= make_terminus(terminus_name)
@@ -139,7 +139,7 @@ class Puppet::Indirector::Indirection
if setting = self.terminus_setting
self.terminus_class = Puppet.settings[setting].to_sym
else
- raise Puppet::DevError, "No terminus class nor terminus setting was provided for indirection %s" % self.name
+ raise Puppet::DevError, "No terminus class nor terminus setting was provided for indirection #{self.name}"
end
end
@terminus_class
@@ -158,10 +158,10 @@ class Puppet::Indirector::Indirection
# This is used by terminus_class= and cache=.
def validate_terminus_class(terminus_class)
unless terminus_class and terminus_class.to_s != ""
- raise ArgumentError, "Invalid terminus name %s" % terminus_class.inspect
+ raise ArgumentError, "Invalid terminus name #{terminus_class.inspect}"
end
unless Puppet::Indirector::Terminus.terminus_class(self.name, terminus_class)
- raise ArgumentError, "Could not find terminus %s for indirection %s" % [terminus_class, self.name]
+ raise ArgumentError, "Could not find terminus #{terminus_class} for indirection #{self.name}"
end
end
@@ -175,7 +175,7 @@ class Puppet::Indirector::Indirection
return nil unless instance = cache.find(request(:find, key, *args))
- Puppet.info "Expiring the %s cache of %s" % [self.name, instance.name]
+ Puppet.info "Expiring the #{self.name} cache of #{instance.name}"
# Set an expiration date in the past
instance.expiration = Time.now - 60
@@ -195,14 +195,14 @@ class Puppet::Indirector::Indirection
end
rescue => detail
puts detail.backtrace if Puppet[:trace]
- Puppet.err "Cached %s for %s failed: %s" % [self.name, request.key, detail]
+ Puppet.err "Cached #{self.name} for #{request.key} failed: #{detail}"
end
# Otherwise, return the result from the terminus, caching if appropriate.
if ! request.ignore_terminus? and result = terminus.find(request)
result.expiration ||= self.expiration
if cache? and request.use_cache?
- Puppet.info "Caching %s for %s" % [self.name, request.key]
+ Puppet.info "Caching #{self.name} for #{request.key}"
cache.save request(:save, result, *args)
end
@@ -216,11 +216,11 @@ class Puppet::Indirector::Indirection
# See if our instance is in the cache and up to date.
return nil unless cache? and ! request.ignore_cache? and cached = cache.find(request)
if cached.expired?
- Puppet.info "Not using expired %s for %s from cache; expired at %s" % [self.name, request.key, cached.expiration]
+ Puppet.info "Not using expired #{self.name} for #{request.key} from cache; expired at #{cached.expiration}"
return nil
end
- Puppet.debug "Using cached %s for %s" % [self.name, request.key]
+ Puppet.debug "Using cached #{self.name} for #{request.key}"
return cached
end
@@ -245,7 +245,7 @@ class Puppet::Indirector::Indirection
terminus = prepare(request)
if result = terminus.search(request)
- raise Puppet::DevError, "Search results from terminus %s are not an array" % terminus.name unless result.is_a?(Array)
+ raise Puppet::DevError, "Search results from terminus #{terminus.name} are not an array" unless result.is_a?(Array)
result.each do |instance|
instance.expiration ||= self.expiration
end
@@ -280,9 +280,9 @@ class Puppet::Indirector::Indirection
return unless terminus.respond_to?(:authorized?)
unless terminus.authorized?(request)
- msg = "Not authorized to call %s on %s" % [request.method, request.to_s]
+ msg = "Not authorized to call #{request.method} on #{request}"
unless request.options.empty?
- msg += " with %s" % request.options.inspect
+ msg += " with #{request.options.inspect}"
end
raise ArgumentError, msg
end
@@ -293,7 +293,7 @@ class Puppet::Indirector::Indirection
# Pick our terminus.
if respond_to?(:select_terminus)
unless terminus_name = select_terminus(request)
- raise ArgumentError, "Could not determine appropriate terminus for %s" % request
+ raise ArgumentError, "Could not determine appropriate terminus for #{request}"
end
else
terminus_name = terminus_class
@@ -309,7 +309,7 @@ class Puppet::Indirector::Indirection
def make_terminus(terminus_class)
# Load our terminus class.
unless klass = Puppet::Indirector::Terminus.terminus_class(self.name, terminus_class)
- raise ArgumentError, "Could not find terminus %s for indirection %s" % [terminus_class, self.name]
+ raise ArgumentError, "Could not find terminus #{terminus_class} for indirection #{self.name}"
end
return klass.new
end
diff --git a/lib/puppet/indirector/key/file.rb b/lib/puppet/indirector/key/file.rb
index a413ccf63..51b5cfd3d 100644
--- a/lib/puppet/indirector/key/file.rb
+++ b/lib/puppet/indirector/key/file.rb
@@ -25,7 +25,7 @@ class Puppet::SSL::Key::File < Puppet::Indirector::SslFile
begin
File.unlink(public_key_path(request.key))
rescue => detail
- raise Puppet::Error, "Could not remove %s public key: %s" % [request.key, detail]
+ raise Puppet::Error, "Could not remove #{request.key} public key: #{detail}"
end
end
@@ -36,7 +36,7 @@ class Puppet::SSL::Key::File < Puppet::Indirector::SslFile
begin
Puppet.settings.writesub(:publickeydir, public_key_path(request.key)) { |f| f.print request.instance.content.public_key.to_pem }
rescue => detail
- raise Puppet::Error, "Could not write %s: %s" % [request.key, detail]
+ raise Puppet::Error, "Could not write #{request.key}: #{detail}"
end
end
end
diff --git a/lib/puppet/indirector/ldap.rb b/lib/puppet/indirector/ldap.rb
index 390fe6793..5888418ee 100644
--- a/lib/puppet/indirector/ldap.rb
+++ b/lib/puppet/indirector/ldap.rb
@@ -10,7 +10,7 @@ class Puppet::Indirector::Ldap < Puppet::Indirector::Terminus
# Process the found entry. We assume that we don't just want the
# ldap object.
def process(entry)
- raise Puppet::DevError, "The 'process' method has not been overridden for the LDAP terminus for %s" % self.name
+ raise Puppet::DevError, "The 'process' method has not been overridden for the LDAP terminus for #{self.name}"
end
# Default to all attributes.
@@ -24,7 +24,7 @@ class Puppet::Indirector::Ldap < Puppet::Indirector::Terminus
# The ldap search filter to use.
def search_filter(name)
- raise Puppet::DevError, "No search string set for LDAP terminus for %s" % self.name
+ raise Puppet::DevError, "No search string set for LDAP terminus for #{self.name}"
end
# Find the ldap node, return the class list and parent node specially,
@@ -71,7 +71,7 @@ class Puppet::Indirector::Ldap < Puppet::Indirector::Terminus
@connection = conn.connection
rescue => detail
puts detail.backtrace if Puppet[:trace]
- raise Puppet::Error, "Could not connect to LDAP: %s" % detail
+ raise Puppet::Error, "Could not connect to LDAP: #{detail}"
end
end
diff --git a/lib/puppet/indirector/memory.rb b/lib/puppet/indirector/memory.rb
index 19acc14e2..332e95bcb 100644
--- a/lib/puppet/indirector/memory.rb
+++ b/lib/puppet/indirector/memory.rb
@@ -7,7 +7,7 @@ class Puppet::Indirector::Memory < Puppet::Indirector::Terminus
end
def destroy(request)
- raise ArgumentError.new("Could not find %s to destroy" % request.key) unless @instances.include?(request.key)
+ raise ArgumentError.new("Could not find #{request.key} to destroy") unless @instances.include?(request.key)
@instances.delete(request.key)
end
diff --git a/lib/puppet/indirector/node/exec.rb b/lib/puppet/indirector/node/exec.rb
index 52cbc370c..445059d14 100644
--- a/lib/puppet/indirector/node/exec.rb
+++ b/lib/puppet/indirector/node/exec.rb
@@ -46,7 +46,7 @@ class Puppet::Node::Exec < Puppet::Indirector::Exec
begin
YAML.load(output).inject({}) { |hash, data| hash[symbolize(data[0])] = data[1]; hash }
rescue => detail
- raise Puppet::Error, "Could not load external node results for %s: %s" % [name, detail]
+ raise Puppet::Error, "Could not load external node results for #{name}: #{detail}"
end
end
end
diff --git a/lib/puppet/indirector/node/ldap.rb b/lib/puppet/indirector/node/ldap.rb
index 2d58df68a..4cbc97573 100644
--- a/lib/puppet/indirector/node/ldap.rb
+++ b/lib/puppet/indirector/node/ldap.rb
@@ -39,7 +39,7 @@ class Puppet::Node::Ldap < Puppet::Indirector::Ldap
end
}
if node_type == 'parent'
- raise Puppet::Error.new("Could not find node '%s' with environment '%s'" % [name,name_env])
+ raise Puppet::Error.new("Could not find node '#{name}' with environment '#{name_env}'")
end
info = name2hash('default',name_env,'parent')
@@ -222,7 +222,7 @@ class Puppet::Node::Ldap < Puppet::Indirector::Ldap
information[:environment] ||= parent_info[:environment]
parent_info[:parent]
else
- raise Puppet::Error.new("Could not find parent node '%s'" % parent)
+ raise Puppet::Error.new("Could not find parent node '#{parent}'")
nil
end
@@ -249,7 +249,7 @@ class Puppet::Node::Ldap < Puppet::Indirector::Ldap
parents = [info[:name]]
while parent
if parents.include?(parent)
- raise ArgumentError, "Found loop in LDAP node parents; %s appears twice" % parent
+ raise ArgumentError, "Found loop in LDAP node parents; #{parent} appears twice"
end
parents << parent
parent = find_and_merge_parent(parent, info)
@@ -289,7 +289,7 @@ class Puppet::Node::Ldap < Puppet::Indirector::Ldap
if values.length > 1
raise Puppet::Error,
- "Node entry %s specifies more than one parent: %s" % [entry.dn, values.inspect]
+ "Node entry #{entry.dn} specifies more than one parent: #{values.inspect}"
end
return nil if values.empty?
return values.shift
diff --git a/lib/puppet/indirector/queue.rb b/lib/puppet/indirector/queue.rb
index 27ef2192c..0e9ff966c 100644
--- a/lib/puppet/indirector/queue.rb
+++ b/lib/puppet/indirector/queue.rb
@@ -36,12 +36,12 @@ class Puppet::Indirector::Queue < Puppet::Indirector::Terminus
def save(request)
begin
result = nil
- benchmark :info, "Queued %s for %s" % [indirection.name, request.key] do
+ benchmark :info, "Queued #{indirection.name} for #{request.key}" do
result = client.send_message(queue, request.instance.render(:pson))
end
result
rescue => detail
- raise Puppet::Error, "Could not write %s to queue: %s\nInstance::%s\n client : %s" % [request.key, detail,request.instance.to_s,client.to_s]
+ raise Puppet::Error, "Could not write #{request.key} to queue: #{detail}\nInstance::#{request.instance}\n client : #{client}"
end
end
@@ -61,7 +61,7 @@ class Puppet::Indirector::Queue < Puppet::Indirector::Terminus
# converts the _message_ from deserialized format to an actual model instance.
def self.intern(message)
result = nil
- benchmark :info, "Loaded queued %s" % [indirection.name] do
+ benchmark :info, "Loaded queued #{indirection.name}" do
result = model.convert_from(:pson, message)
end
result
@@ -76,7 +76,7 @@ class Puppet::Indirector::Queue < Puppet::Indirector::Terminus
yield(self.intern(msg))
rescue => detail
puts detail.backtrace if Puppet[:trace]
- Puppet.err "Error occured with subscription to queue %s for indirection %s: %s" % [queue, indirection_name, detail]
+ Puppet.err "Error occured with subscription to queue #{queue} for indirection #{indirection_name}: #{detail}"
end
end
end
diff --git a/lib/puppet/indirector/report/processor.rb b/lib/puppet/indirector/report/processor.rb
index 1ff2e0e84..1b4c5ef8d 100644
--- a/lib/puppet/indirector/report/processor.rb
+++ b/lib/puppet/indirector/report/processor.rb
@@ -34,10 +34,10 @@ class Puppet::Transaction::Report::Processor < Puppet::Indirector::Code
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/indirector/request.rb b/lib/puppet/indirector/request.rb
index cd354ac16..6d19e59d7 100644
--- a/lib/puppet/indirector/request.rb
+++ b/lib/puppet/indirector/request.rb
@@ -100,7 +100,7 @@ class Puppet::Indirector::Request
def model
- raise ArgumentError, "Could not find indirection '%s'" % indirection_name unless i = indirection
+ raise ArgumentError, "Could not find indirection '#{indirection_name}'" unless i = indirection
i.model
end
@@ -130,10 +130,10 @@ class Puppet::Indirector::Request
when Symbol; value = CGI.escape(value.to_s)
when Array; value = CGI.escape(YAML.dump(value))
else
- raise ArgumentError, "HTTP REST queries cannot handle values of type '%s'" % value.class
+ raise ArgumentError, "HTTP REST queries cannot handle values of type '#{value.class}'"
end
- "%s=%s" % [key, value]
+ "#{key}=#{value}"
end.join("&")
end
@@ -150,7 +150,7 @@ class Puppet::Indirector::Request
def to_s
return uri if uri
- return "/%s/%s" % [indirection_name, key]
+ return "/#{indirection_name}/#{key}"
end
private
@@ -170,7 +170,7 @@ class Puppet::Indirector::Request
begin
uri = URI.parse(URI.escape(key))
rescue => detail
- raise ArgumentError, "Could not understand URL %s: %s" % [key, detail.to_s]
+ raise ArgumentError, "Could not understand URL #{key}: #{detail}"
end
# Just short-circuit these to full paths
diff --git a/lib/puppet/indirector/rest.rb b/lib/puppet/indirector/rest.rb
index f9b11c16f..f38d1f927 100644
--- a/lib/puppet/indirector/rest.rb
+++ b/lib/puppet/indirector/rest.rb
@@ -55,7 +55,7 @@ class Puppet::Indirector::REST < Puppet::Indirector::Terminus
end
else
# Raise the http error if we didn't get a 'success' of some kind.
- message = "Error %s on SERVER: %s" % [response.code, (response.body||'').empty? ? response.message : uncompress_body(response)]
+ message = "Error #{response.code} on SERVER: #{(response.body||'').empty? ? response.message : uncompress_body(response)}"
raise Net::HTTPError.new(message, response)
end
end
diff --git a/lib/puppet/indirector/ssl_file.rb b/lib/puppet/indirector/ssl_file.rb
index 67202699d..f8034a4a1 100644
--- a/lib/puppet/indirector/ssl_file.rb
+++ b/lib/puppet/indirector/ssl_file.rb
@@ -49,7 +49,7 @@ class Puppet::Indirector::SslFile < Puppet::Indirector::Terminus
def initialize
Puppet.settings.use(:main, :ssl)
- (collection_directory || file_location) or raise Puppet::DevError, "No file or directory setting provided; terminus %s cannot function" % self.class.name
+ (collection_directory || file_location) or raise Puppet::DevError, "No file or directory setting provided; terminus #{self.class.name} cannot function"
end
# Use a setting to determine our path.
@@ -68,11 +68,11 @@ class Puppet::Indirector::SslFile < Puppet::Indirector::Terminus
path = path(request.key)
return false unless FileTest.exist?(path)
- Puppet.notice "Removing file %s %s at '%s'" % [model, request.key, path]
+ Puppet.notice "Removing file #{model} #{request.key} at '#{path}'"
begin
File.unlink(path)
rescue => detail
- raise Puppet::Error, "Could not remove %s: %s" % [request.key, detail]
+ raise Puppet::Error, "Could not remove #{request.key}: #{detail}"
end
end
@@ -92,8 +92,8 @@ class Puppet::Indirector::SslFile < Puppet::Indirector::Terminus
path = path(request.key)
dir = File.dirname(path)
- raise Puppet::Error.new("Cannot save %s; parent directory %s does not exist" % [request.key, dir]) unless FileTest.directory?(dir)
- raise Puppet::Error.new("Cannot save %s; parent directory %s is not writable" % [request.key, dir]) unless FileTest.writable?(dir)
+ raise Puppet::Error.new("Cannot save #{request.key}; parent directory #{dir} does not exist") unless FileTest.directory?(dir)
+ raise Puppet::Error.new("Cannot save #{request.key}; parent directory #{dir} is not writable") unless FileTest.writable?(dir)
write(request.key, path) { |f| f.print request.instance.to_s }
end
@@ -143,7 +143,7 @@ class Puppet::Indirector::SslFile < Puppet::Indirector::Terminus
full_file = File.join(dir, real_file)
- Puppet.notice "Fixing case in %s; renaming to %s" % [full_file, file]
+ Puppet.notice "Fixing case in #{full_file}; renaming to #{file}"
File.rename(full_file, file)
return true
@@ -160,7 +160,7 @@ class Puppet::Indirector::SslFile < Puppet::Indirector::Terminus
begin
Puppet.settings.writesub(setting, path) { |f| yield f }
rescue => detail
- raise Puppet::Error, "Could not write %s to %s: %s" % [path, setting, detail]
+ raise Puppet::Error, "Could not write #{path} to #{setting}: #{detail}"
end
else
raise Puppet::DevError, "You must provide a setting to determine where the files are stored"
diff --git a/lib/puppet/indirector/terminus.rb b/lib/puppet/indirector/terminus.rb
index 4d1d58f87..60f8ec1f2 100644
--- a/lib/puppet/indirector/terminus.rb
+++ b/lib/puppet/indirector/terminus.rb
@@ -21,7 +21,7 @@ class Puppet::Indirector::Terminus
# Convert a constant to a short name.
def const2name(const)
- const.sub(/^[A-Z]/) { |i| i.downcase }.gsub(/[A-Z]/) { |i| "_" + i.downcase }.intern
+ const.sub(/^[A-Z]/) { |i| i.downcase }.gsub(/[A-Z]/) { |i| "_#{i.downcase}" }.intern
end
# Look up the indirection if we were only provided a name.
@@ -31,7 +31,7 @@ class Puppet::Indirector::Terminus
elsif ind = Puppet::Indirector::Indirection.instance(name)
@indirection = ind
else
- raise ArgumentError, "Could not find indirection instance %s for %s" % [name, self.name]
+ raise ArgumentError, "Could not find indirection instance #{name} for #{self.name}"
end
end
@@ -50,7 +50,7 @@ class Puppet::Indirector::Terminus
names = longname.split("::")
# Convert everything to a lower-case symbol, converting camelcase to underscore word separation.
- name = names.pop.sub(/^[A-Z]/) { |i| i.downcase }.gsub(/[A-Z]/) { |i| "_" + i.downcase }.intern
+ name = names.pop.sub(/^[A-Z]/) { |i| i.downcase }.gsub(/[A-Z]/) { |i| "_#{i.downcase}" }.intern
subclass.name = name
@@ -66,8 +66,8 @@ class Puppet::Indirector::Terminus
subclass.terminus_type = self.name
# Our subclass is specifically associated with an indirection.
- raise("Invalid name %s" % longname) unless names.length > 0
- indirection_name = names.pop.sub(/^[A-Z]/) { |i| i.downcase }.gsub(/[A-Z]/) { |i| "_" + i.downcase }.intern
+ raise("Invalid name #{longname}") unless names.length > 0
+ indirection_name = names.pop.sub(/^[A-Z]/) { |i| i.downcase }.gsub(/[A-Z]/) { |i| "_#{i.downcase}" }.intern
if indirection_name == "" or indirection_name.nil?
raise Puppet::DevError, "Could not discern indirection model from class constant"
@@ -123,7 +123,7 @@ class Puppet::Indirector::Terminus
def setup_instance_loading(type)
unless instance_loading?(type)
- instance_load type, "puppet/indirector/%s" % type
+ instance_load type, "puppet/indirector/#{type}"
end
end
end
diff --git a/lib/puppet/indirector/yaml.rb b/lib/puppet/indirector/yaml.rb
index 2ff267f06..d82cbfa1d 100644
--- a/lib/puppet/indirector/yaml.rb
+++ b/lib/puppet/indirector/yaml.rb
@@ -14,12 +14,12 @@ class Puppet::Indirector::Yaml < Puppet::Indirector::Terminus
begin
readlock(file) { |fh| yaml = fh.read }
rescue => detail
- raise Puppet::Error, "Could not read YAML data for %s %s: %s" % [indirection.name, request.key, detail]
+ raise Puppet::Error, "Could not read YAML data for #{indirection.name} #{request.key}: #{detail}"
end
begin
return from_yaml(yaml)
rescue => detail
- raise Puppet::Error, "Could not parse YAML data for %s %s: %s" % [indirection.name, request.key, detail]
+ raise Puppet::Error, "Could not parse YAML data for #{indirection.name} #{request.key}: #{detail}"
end
end
@@ -39,7 +39,7 @@ class Puppet::Indirector::Yaml < Puppet::Indirector::Terminus
begin
writelock(file, 0660) { |f| f.print to_yaml(request.instance) }
rescue TypeError => detail
- Puppet.err "Could not save %s %s: %s" % [self.name, request.key, detail]
+ Puppet.err "Could not save #{self.name} #{request.key}: #{detail}"
end
end
diff --git a/lib/puppet/metatype/manager.rb b/lib/puppet/metatype/manager.rb
index 590562633..6d634c245 100644
--- a/lib/puppet/metatype/manager.rb
+++ b/lib/puppet/metatype/manager.rb
@@ -33,7 +33,7 @@ module Manager
def newtype(name, options = {}, &block)
# Handle backward compatibility
unless options.is_a?(Hash)
- Puppet.warning "Puppet::Type.newtype(%s) now expects a hash as the second argument, not %s" % [name, options.inspect]
+ Puppet.warning "Puppet::Type.newtype(#{name}) now expects a hash as the second argument, not #{options.inspect}"
options = {:parent => options}
end
@@ -111,8 +111,8 @@ module Manager
:hash => @types
)
- if respond_to?("new" + name.to_s)
- singleton_class.send(:remove_method, "new" + name.to_s)
+ if respond_to?("new#{name}")
+ singleton_class.send(:remove_method, "new#{name}")
end
end
diff --git a/lib/puppet/module.rb b/lib/puppet/module.rb
index 995262ddf..611cbdd4b 100644
--- a/lib/puppet/module.rb
+++ b/lib/puppet/module.rb
@@ -157,9 +157,9 @@ class Puppet::Module
end
def to_s
- result = "Module %s" % name
+ result = "Module #{name}"
if path
- result += "(%s)" % path
+ result += "(#{path})"
end
result
end
@@ -201,6 +201,6 @@ class Puppet::Module
end
def assert_validity
- raise InvalidName, "Invalid module name; module names must be alphanumeric (plus '-'), not '%s'" % name unless name =~ /^[-\w]+$/
+ raise InvalidName, "Invalid module name; module names must be alphanumeric (plus '-'), not '#{name}'" unless name =~ /^[-\w]+$/
end
end
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
diff --git a/lib/puppet/node.rb b/lib/puppet/node.rb
index 0d9783b5a..2418b3e44 100644
--- a/lib/puppet/node.rb
+++ b/lib/puppet/node.rb
@@ -63,7 +63,7 @@ class Puppet::Node
merge(facts.values)
end
rescue => detail
- error = Puppet::Error.new("Could not retrieve facts for %s: %s" % [name, detail])
+ error = Puppet::Error.new("Could not retrieve facts for #{name}: #{detail}")
error.set_backtrace(detail.backtrace)
raise error
end
@@ -96,7 +96,7 @@ class Puppet::Node
if parameters["hostname"] and parameters["domain"]
fqdn = parameters["hostname"] + "." + parameters["domain"]
else
- Puppet.warning "Host is missing hostname and/or domain: %s" % name
+ Puppet.warning "Host is missing hostname and/or domain: #{name}"
end
end
diff --git a/lib/puppet/parameter.rb b/lib/puppet/parameter.rb
index 4197c8c4a..82b603a57 100644
--- a/lib/puppet/parameter.rb
+++ b/lib/puppet/parameter.rb
@@ -44,7 +44,7 @@ class Puppet::Parameter
@doc += value_collection.doc
if f = self.required_features
- @doc += " Requires features %s." % f.flatten.collect { |f| f.to_s }.join(" ")
+ @doc += " Requires features #{f.flatten.collect { |f| f.to_s }.join(" ")}."
end
@addeddocvals = true
end
@@ -192,7 +192,7 @@ class Puppet::Parameter
self.resource = resource
options.delete(:resource)
else
- raise Puppet::DevError, "No resource set for %s" % self.class.name
+ raise Puppet::DevError, "No resource set for #{self.class.name}"
end
set_options(options)
@@ -221,7 +221,7 @@ class Puppet::Parameter
@noop = false
end
tmp = @noop || self.resource.noop || Puppet[:noop] || false
- #debug "noop is %s" % tmp
+ #debug "noop is #{tmp}"
return tmp
end
@@ -251,10 +251,10 @@ class Puppet::Parameter
begin
ret = unsafe_munge(value)
rescue Puppet::Error => detail
- Puppet.debug "Reraising %s" % detail
+ Puppet.debug "Reraising #{detail}"
raise
rescue => detail
- raise Puppet::DevError, "Munging failed for value %s in class %s: %s" % [value.inspect, self.name, detail], detail.backtrace
+ raise Puppet::DevError, "Munging failed for value #{value.inspect} in class #{self.name}: #{detail}", detail.backtrace
end
ret
end
@@ -274,7 +274,7 @@ class Puppet::Parameter
rescue Puppet::Error, TypeError
raise
rescue => detail
- raise Puppet::DevError, "Validate method failed for class %s: %s" % [self.name, detail], detail.backtrace
+ raise Puppet::DevError, "Validate method failed for class #{self.name}: #{detail}", detail.backtrace
end
end
diff --git a/lib/puppet/parameter/value_collection.rb b/lib/puppet/parameter/value_collection.rb
index 436226ebe..840b892f1 100644
--- a/lib/puppet/parameter/value_collection.rb
+++ b/lib/puppet/parameter/value_collection.rb
@@ -7,7 +7,7 @@ class Puppet::Parameter::ValueCollection
def aliasvalue(name, other)
other = other.to_sym
unless value = match?(other)
- raise Puppet::DevError, "Cannot alias nonexistent value %s" % other
+ raise Puppet::DevError, "Cannot alias nonexistent value #{other}"
end
value.alias(name)
@@ -21,9 +21,9 @@ class Puppet::Parameter::ValueCollection
@doc += " Valid values are "
@doc += @strings.collect do |value|
if aliases = value.aliases and ! aliases.empty?
- "``%s`` (also called ``%s``)" % [value.name, aliases.join(", ")]
+ "``#{value.name}`` (also called ``#{aliases.join(", ")}``)"
else
- "``%s``" % value.name
+ "``#{value.name}``"
end
end.join(", ") + "."
end
@@ -105,7 +105,7 @@ class Puppet::Parameter::ValueCollection
end
if block_given? and ! value.regex?
- value.method ||= "set_" + value.name.to_s
+ value.method ||= "set_#{value.name}"
end
value
@@ -125,14 +125,14 @@ class Puppet::Parameter::ValueCollection
return if empty?
unless @values.detect { |name, v| v.match?(value) }
- str = "Invalid value %s. " % [value.inspect]
+ str = "Invalid value #{value.inspect}. "
unless values.empty?
- str += "Valid values are %s. " % values.join(", ")
+ str += "Valid values are #{values.join(", ")}. "
end
unless regexes.empty?
- str += "Valid values match %s." % regexes.join(", ")
+ str += "Valid values match #{regexes.join(", ")}."
end
raise ArgumentError, str
diff --git a/lib/puppet/parser/ast.rb b/lib/puppet/parser/ast.rb
index f407c78d6..dffc30a8a 100644
--- a/lib/puppet/parser/ast.rb
+++ b/lib/puppet/parser/ast.rb
@@ -46,7 +46,7 @@ class Puppet::Parser::AST
# of the contained children and evaluates them in turn, returning a
# list of all of the collected values, rejecting nil values
def evaluate(*options)
- raise Puppet::DevError, "Did not override #evaluate in %s" % self.class
+ raise Puppet::DevError, "Did not override #evaluate in #{self.class}"
end
# Throw a parse error.
diff --git a/lib/puppet/parser/ast/arithmetic_operator.rb b/lib/puppet/parser/ast/arithmetic_operator.rb
index 8d9cef86a..b4c0215cc 100644
--- a/lib/puppet/parser/ast/arithmetic_operator.rb
+++ b/lib/puppet/parser/ast/arithmetic_operator.rb
@@ -18,12 +18,12 @@ class Puppet::Parser::AST
lval = @lval.safeevaluate(scope)
lval = Puppet::Parser::Scope.number?(lval)
if lval == nil
- raise ArgumentError, "left operand of %s is not a number" % @operator
+ raise ArgumentError, "left operand of #{@operator} is not a number"
end
rval = @rval.safeevaluate(scope)
rval = Puppet::Parser::Scope.number?(rval)
if rval == nil
- raise ArgumentError, "right operand of %s is not a number" % @operator
+ raise ArgumentError, "right operand of #{@operator} is not a number"
end
# compute result
@@ -34,7 +34,7 @@ class Puppet::Parser::AST
super
unless %w{+ - * / << >>}.include?(@operator)
- raise ArgumentError, "Invalid arithmetic operator %s" % @operator
+ raise ArgumentError, "Invalid arithmetic operator #{@operator}"
end
end
end
diff --git a/lib/puppet/parser/ast/boolean_operator.rb b/lib/puppet/parser/ast/boolean_operator.rb
index 89725d73b..9214afbd5 100644
--- a/lib/puppet/parser/ast/boolean_operator.rb
+++ b/lib/puppet/parser/ast/boolean_operator.rb
@@ -41,7 +41,7 @@ class Puppet::Parser::AST
super
unless %w{and or}.include?(@operator)
- raise ArgumentError, "Invalid boolean operator %s" % @operator
+ raise ArgumentError, "Invalid boolean operator #{@operator}"
end
end
end
diff --git a/lib/puppet/parser/ast/branch.rb b/lib/puppet/parser/ast/branch.rb
index 0c481ffe6..c0fa0da30 100644
--- a/lib/puppet/parser/ast/branch.rb
+++ b/lib/puppet/parser/ast/branch.rb
@@ -31,7 +31,7 @@ class Puppet::Parser::AST
@children.each { |child|
unless child.is_a?(AST)
raise Puppet::DevError,
- "child %s is a %s instead of ast" % [child, child.class]
+ "child #{child} is a #{child.class} instead of ast"
end
}
end
diff --git a/lib/puppet/parser/ast/collexpr.rb b/lib/puppet/parser/ast/collexpr.rb
index eae2b0e42..95fb5a94f 100644
--- a/lib/puppet/parser/ast/collexpr.rb
+++ b/lib/puppet/parser/ast/collexpr.rb
@@ -68,11 +68,10 @@ class CollExpr < AST::Branch
when "tag"
str = "puppet_tags.name #{oper} '#{str2}'"
else
- str = "param_values.value #{oper} '#{str2}' and " +
- "param_names.name = '#{str1}'"
+ str = "param_values.value #{oper} '#{str2}' and param_names.name = '#{str1}'"
end
else
- str = "(%s) %s (%s)" % [str1, oper, str2]
+ str = "(#{str1}) #{oper} (#{str2})"
end
return str, code
@@ -82,7 +81,7 @@ class CollExpr < AST::Branch
super
unless %w{== != and or}.include?(@oper)
- raise ArgumentError, "Invalid operator %s" % @oper
+ raise ArgumentError, "Invalid operator #{@oper}"
end
end
end
diff --git a/lib/puppet/parser/ast/comparison_operator.rb b/lib/puppet/parser/ast/comparison_operator.rb
index 0d2f8b16d..85903ec31 100644
--- a/lib/puppet/parser/ast/comparison_operator.rb
+++ b/lib/puppet/parser/ast/comparison_operator.rb
@@ -34,7 +34,7 @@ class Puppet::Parser::AST
super
unless %w{== != < > <= >=}.include?(@operator)
- raise ArgumentError, "Invalid comparison operator %s" % @operator
+ raise ArgumentError, "Invalid comparison operator #{@operator}"
end
end
end
diff --git a/lib/puppet/parser/ast/function.rb b/lib/puppet/parser/ast/function.rb
index 98204b14a..c3769cbd4 100644
--- a/lib/puppet/parser/ast/function.rb
+++ b/lib/puppet/parser/ast/function.rb
@@ -14,28 +14,28 @@ class Puppet::Parser::AST
# Make sure it's a defined function
unless Puppet::Parser::Functions.function(@name)
- raise Puppet::ParseError, "Unknown function %s" % @name
+ raise Puppet::ParseError, "Unknown function #{@name}"
end
# Now check that it's been used correctly
case @ftype
when :rvalue
unless Puppet::Parser::Functions.rvalue?(@name)
- raise Puppet::ParseError, "Function '%s' does not return a value" % @name
+ raise Puppet::ParseError, "Function '#{@name}' does not return a value"
end
when :statement
if Puppet::Parser::Functions.rvalue?(@name)
raise Puppet::ParseError,
- "Function '%s' must be the value of a statement" % @name
+ "Function '#{@name}' must be the value of a statement"
end
else
- raise Puppet::DevError, "Invalid function type %s" % @ftype.inspect
+ raise Puppet::DevError, "Invalid function type #{@ftype.inspect}"
end
# We don't need to evaluate the name, because it's plaintext
args = @arguments.safeevaluate(scope)
- return scope.send("function_" + @name, args)
+ return scope.send("function_#{@name}", args)
end
def initialize(hash)
diff --git a/lib/puppet/parser/ast/leaf.rb b/lib/puppet/parser/ast/leaf.rb
index 30c4a958f..6ef346123 100644
--- a/lib/puppet/parser/ast/leaf.rb
+++ b/lib/puppet/parser/ast/leaf.rb
@@ -40,7 +40,7 @@ class Puppet::Parser::AST
unless @value == true or @value == false
raise Puppet::DevError,
- "'%s' is not a boolean" % @value
+ "'#{@value}' is not a boolean"
end
@value
end
@@ -108,7 +108,7 @@ class Puppet::Parser::AST
@value = @value.to_s.downcase unless @value.is_a?(Regex)
if @value =~ /[^-\w.]/
raise Puppet::DevError,
- "'%s' is not a valid hostname" % @value
+ "'#{@value}' is not a valid hostname"
end
end
diff --git a/lib/puppet/parser/ast/match_operator.rb b/lib/puppet/parser/ast/match_operator.rb
index 17e27826e..c528a90e5 100644
--- a/lib/puppet/parser/ast/match_operator.rb
+++ b/lib/puppet/parser/ast/match_operator.rb
@@ -24,7 +24,7 @@ class Puppet::Parser::AST
super
unless %w{!~ =~}.include?(@operator)
- raise ArgumentError, "Invalid regexp operator %s" % @operator
+ raise ArgumentError, "Invalid regexp operator #{@operator}"
end
end
end
diff --git a/lib/puppet/parser/ast/minus.rb b/lib/puppet/parser/ast/minus.rb
index b0779a8ee..52d158e0b 100644
--- a/lib/puppet/parser/ast/minus.rb
+++ b/lib/puppet/parser/ast/minus.rb
@@ -15,7 +15,7 @@ class Puppet::Parser::AST
val = @value.safeevaluate(scope)
val = Puppet::Parser::Scope.number?(val)
if val == nil
- raise ArgumentError, "minus operand %s is not a number" % val
+ raise ArgumentError, "minus operand #{val} is not a number"
end
return -val
end
diff --git a/lib/puppet/parser/ast/resource_override.rb b/lib/puppet/parser/ast/resource_override.rb
index f667ed23a..f9071fe96 100644
--- a/lib/puppet/parser/ast/resource_override.rb
+++ b/lib/puppet/parser/ast/resource_override.rb
@@ -13,7 +13,7 @@ class Puppet::Parser::AST
# Iterate across all of our children.
def each
[@object,@parameters].flatten.each { |param|
- #Puppet.debug("yielding param %s" % param)
+ #Puppet.debug("yielding param #{param}")
yield param
}
end
diff --git a/lib/puppet/parser/ast/selector.rb b/lib/puppet/parser/ast/selector.rb
index 647bdcde1..8eb930cc4 100644
--- a/lib/puppet/parser/ast/selector.rb
+++ b/lib/puppet/parser/ast/selector.rb
@@ -34,7 +34,7 @@ class Puppet::Parser::AST
# Unless we found something, look for the default.
return default.value.safeevaluate(scope) if default
- self.fail Puppet::ParseError, "No matching value for selector param '%s'" % paramvalue
+ self.fail Puppet::ParseError, "No matching value for selector param '#{paramvalue}'"
ensure
scope.unset_ephemeral_var(level)
end
diff --git a/lib/puppet/parser/collector.rb b/lib/puppet/parser/collector.rb
index 9283d06ae..3f1432af2 100644
--- a/lib/puppet/parser/collector.rb
+++ b/lib/puppet/parser/collector.rb
@@ -80,7 +80,7 @@ class Puppet::Parser::Collector
@equery = equery
@vquery = vquery
- raise(ArgumentError, "Invalid query form %s" % form) unless [:exported, :virtual].include?(form)
+ raise(ArgumentError, "Invalid query form #{form}") unless [:exported, :virtual].include?(form)
@form = form
end
@@ -106,7 +106,7 @@ class Puppet::Parser::Collector
search = "(exported=? AND restype=?)"
values = [true, @type]
- search += " AND (%s)" % @equery if @equery
+ search += " AND (#{@equery})" if @equery
# note:
# we're not eagerly including any relations here because
@@ -125,7 +125,7 @@ class Puppet::Parser::Collector
# We're going to collect objects from rails, but we don't want any
# objects from this host.
- search = ("host_id != ? AND %s" % search) and values.unshift(host.id) if host
+ search = ("host_id != ? AND #{search}") and values.unshift(host.id) if host
query[:conditions] = [search, *values]
@@ -207,7 +207,7 @@ class Puppet::Parser::Collector
return nil if existing.rails_id == obj.id
# This is the one we've already collected
- raise Puppet::ParseError, "Exported resource %s cannot override local resource" % [obj.ref]
+ raise Puppet::ParseError, "Exported resource #{obj.ref} cannot override local resource"
end
resource = obj.to_resource(self.scope)
diff --git a/lib/puppet/parser/compiler.rb b/lib/puppet/parser/compiler.rb
index e64ec4ba3..a2186b2c9 100644
--- a/lib/puppet/parser/compiler.rb
+++ b/lib/puppet/parser/compiler.rb
@@ -158,7 +158,7 @@ class Puppet::Parser::Compiler
resource.evaluate unless lazy_evaluate
found << name
else
- Puppet.info "Could not find class %s for %s" % [name, node.name]
+ Puppet.info "Could not find class #{name} for #{node.name}"
@catalog.tag(name)
end
end
@@ -181,7 +181,7 @@ class Puppet::Parser::Compiler
begin
send(param.to_s + "=", value)
rescue NoMethodError
- raise ArgumentError, "Compiler objects do not accept %s" % param
+ raise ArgumentError, "Compiler objects do not accept #{param}"
end
end
@@ -222,7 +222,7 @@ class Puppet::Parser::Compiler
end
unless (astnode ||= known_resource_types.node("default"))
- raise Puppet::ParseError, "Could not find default node or by name with '%s'" % node.names.join(", ")
+ raise Puppet::ParseError, "Could not find default node or by name with '#{node.names.join(", ")}'"
end
# Create a resource to model this node, and then add it to the list
@@ -355,7 +355,7 @@ class Puppet::Parser::Compiler
end
unless remaining.empty?
- raise Puppet::ParseError, "Failed to realize virtual resources %s" % remaining.join(', ')
+ raise Puppet::ParseError, "Failed to realize virtual resources #{remaining.join(', ')}"
end
end
diff --git a/lib/puppet/parser/functions.rb b/lib/puppet/parser/functions.rb
index a99e8dc95..5b07a9c09 100644
--- a/lib/puppet/parser/functions.rb
+++ b/lib/puppet/parser/functions.rb
@@ -41,16 +41,16 @@ module Puppet::Parser::Functions
name = symbolize(name)
if functions.include?(name)
- raise Puppet::DevError, "Function %s already defined" % name
+ raise Puppet::DevError, "Function #{name} already defined"
end
ftype = options[:type] || :statement
unless ftype == :statement or ftype == :rvalue
- raise Puppet::DevError, "Invalid statement type %s" % ftype.inspect
+ raise Puppet::DevError, "Invalid statement type #{ftype.inspect}"
end
- fname = "function_" + name.to_s
+ fname = "function_#{name}"
environment_module.send(:define_method, fname, &block)
# Someday we'll support specifying an arity, but for now, nope
@@ -66,12 +66,12 @@ module Puppet::Parser::Functions
name = symbolize(name)
unless functions.include? name
- raise Puppet::DevError, "Function %s is not defined" % name
+ raise Puppet::DevError, "Function #{name} is not defined"
end
functions.delete name
- fname = "function_" + name.to_s
+ fname = "function_#{name}"
environment_module.send(:remove_method, fname)
end
@@ -92,15 +92,15 @@ module Puppet::Parser::Functions
ret = ""
functions.sort { |a,b| a[0].to_s <=> b[0].to_s }.each do |name, hash|
- #ret += "%s\n%s\n" % [name, hash[:type]]
- ret += "%s\n%s\n" % [name, "-" * name.to_s.length]
+ #ret += "#{name}\n#{hash[:type]}\n"
+ ret += "#{name}\n#{"-" * name.to_s.length}\n"
if hash[:doc]
ret += Puppet::Util::Docs.scrub(hash[:doc])
else
ret += "Undocumented.\n"
end
- ret += "\n\n- **Type**: %s\n\n" % hash[:type]
+ ret += "\n\n- **Type**: #{hash[:type]}\n\n"
end
return ret
diff --git a/lib/puppet/parser/functions/file.rb b/lib/puppet/parser/functions/file.rb
index f78823d3a..d13b01ede 100644
--- a/lib/puppet/parser/functions/file.rb
+++ b/lib/puppet/parser/functions/file.rb
@@ -18,6 +18,6 @@
if ret
ret
else
- raise Puppet::ParseError, "Could not find any files from %s" % vals.join(", ")
+ raise Puppet::ParseError, "Could not find any files from #{vals.join(", ")}"
end
end
diff --git a/lib/puppet/parser/functions/include.rb b/lib/puppet/parser/functions/include.rb
index 213a04136..a8b6f175b 100644
--- a/lib/puppet/parser/functions/include.rb
+++ b/lib/puppet/parser/functions/include.rb
@@ -19,7 +19,7 @@ Puppet::Parser::Functions::newfunction(:include, :doc => "Evaluate one or more c
str += " " + missing.join(", ")
if n = namespaces and ! n.empty? and n != [""]
- str += " in namespaces %s" % @namespaces.join(", ")
+ str += " in namespaces #{@namespaces.join(", ")}"
end
self.fail Puppet::ParseError, str
end
diff --git a/lib/puppet/parser/functions/inline_template.rb b/lib/puppet/parser/functions/inline_template.rb
index fde8006b4..6c0485d1e 100644
--- a/lib/puppet/parser/functions/inline_template.rb
+++ b/lib/puppet/parser/functions/inline_template.rb
@@ -14,7 +14,7 @@ Puppet::Parser::Functions::newfunction(:inline_template, :type => :rvalue, :doc
wrapper.result(string)
rescue => detail
raise Puppet::ParseError,
- "Failed to parse inline template: %s" % [detail]
+ "Failed to parse inline template: #{detail}"
end
end.join("")
end
diff --git a/lib/puppet/parser/functions/require.rb b/lib/puppet/parser/functions/require.rb
index 45b89c77a..c5c4c851f 100644
--- a/lib/puppet/parser/functions/require.rb
+++ b/lib/puppet/parser/functions/require.rb
@@ -43,7 +43,7 @@ fail if used with earlier clients.
if classobj = find_hostclass(klass)
klass = classobj.name
else
- raise Puppet::ParseError, "Could not find class %s" % klass
+ raise Puppet::ParseError, "Could not find class #{klass}"
end
# This is a bit hackish, in some ways, but it's the only way
diff --git a/lib/puppet/parser/functions/split.rb b/lib/puppet/parser/functions/split.rb
index 405a5bc9a..c3466ba4a 100644
--- a/lib/puppet/parser/functions/split.rb
+++ b/lib/puppet/parser/functions/split.rb
@@ -23,7 +23,7 @@ way to do that for a single character is to enclose it in square
brackets.") do |args|
if args.length != 2
- raise Puppet::ParseError, ("split(): wrong number of arguments" + " (#{args.length}; must be 2)")
+ raise Puppet::ParseError, ("split(): wrong number of arguments (#{args.length}; must be 2)")
end
return args[0].split(Regexp.compile(args[1]))
diff --git a/lib/puppet/parser/functions/template.rb b/lib/puppet/parser/functions/template.rb
index 35c54c66a..6c4873efe 100644
--- a/lib/puppet/parser/functions/template.rb
+++ b/lib/puppet/parser/functions/template.rb
@@ -8,7 +8,7 @@ Puppet::Parser::Functions::newfunction(:template, :type => :rvalue, :doc =>
vals.collect do |file|
# Use a wrapper, so the template can't get access to the full
# Scope object.
- debug "Retrieving template %s" % file
+ debug "Retrieving template #{file}"
wrapper = Puppet::Parser::TemplateWrapper.new(self)
wrapper.file = file
@@ -16,7 +16,7 @@ Puppet::Parser::Functions::newfunction(:template, :type => :rvalue, :doc =>
wrapper.result
rescue => detail
raise Puppet::ParseError,
- "Failed to parse template %s: %s" % [file, detail]
+ "Failed to parse template #{file}: #{detail}"
end
end.join("")
end
diff --git a/lib/puppet/parser/lexer.rb b/lib/puppet/parser/lexer.rb
index 5d1ce8bc7..b5eab9fc8 100644
--- a/lib/puppet/parser/lexer.rb
+++ b/lib/puppet/parser/lexer.rb
@@ -63,7 +63,7 @@ class Puppet::Parser::Lexer
# Create a new token.
def add_token(name, regex, options = {}, &block)
token = Token.new(regex, name)
- raise(ArgumentError, "Token %s already exists" % name) if @tokens.include?(name)
+ raise(ArgumentError, "Token #{name} already exists") if @tokens.include?(name)
@tokens[token.name] = token
if token.string
@string_tokens << token
@@ -487,7 +487,7 @@ class Puppet::Parser::Lexer
if @previous_token.name == :DEFINE
if indefine?
- msg = "Cannot nest definition %s inside %s" % [value, @indefine]
+ msg = "Cannot nest definition #{value} inside #{@indefine}"
self.indefine = false
raise Puppet::ParseError, msg
end
diff --git a/lib/puppet/parser/parser_support.rb b/lib/puppet/parser/parser_support.rb
index 24ee5fab3..f2fd710cf 100644
--- a/lib/puppet/parser/parser_support.rb
+++ b/lib/puppet/parser/parser_support.rb
@@ -21,9 +21,9 @@ class Puppet::Parser::Parser
def addcontext(message, obj = nil)
obj ||= @lexer
- message += " on line %s" % obj.line
+ message += " on line #{obj.line}"
if file = obj.file
- message += " in file %s" % file
+ message += " in file #{file}"
end
return message
@@ -91,7 +91,7 @@ class Puppet::Parser::Parser
file = file + ".pp"
end
unless FileTest.exist?(file)
- raise Puppet::Error, "Could not find file %s" % file
+ raise Puppet::Error, "Could not find file #{file}"
end
end
raise Puppet::AlreadyImportedError, "Import loop detected" if known_resource_types.watching_file?(file)
@@ -161,12 +161,12 @@ class Puppet::Parser::Parser
if token == 0 # denotes end of file
value = 'end of file'
else
- value = "'%s'" % value[:value]
+ value = "'#{value[:value]}'"
end
- error = "Syntax error at %s" % [value]
+ error = "Syntax error at #{value}"
if brace = @lexer.expected
- error += "; expected '%s'" % brace
+ error += "; expected '#{brace}'"
end
except = Puppet::ParseError.new(error)
diff --git a/lib/puppet/parser/resource.rb b/lib/puppet/parser/resource.rb
index e1af32fba..257440ab4 100644
--- a/lib/puppet/parser/resource.rb
+++ b/lib/puppet/parser/resource.rb
@@ -248,7 +248,7 @@ class Puppet::Parser::Resource < Puppet::Resource
def add_defaults
scope.lookupdefaults(self.type).each do |name, param|
unless @parameters.include?(name)
- self.debug "Adding default for %s" % name
+ self.debug "Adding default for #{name}"
@parameters[name] = param.dup
end
@@ -286,15 +286,15 @@ class Puppet::Parser::Resource < Puppet::Resource
# The parameter is already set. Fail if they're not allowed to override it.
unless param.source.child_of?(current.source)
puts caller if Puppet[:trace]
- msg = "Parameter '%s' is already set on %s" % [param.name, self.to_s]
+ msg = "Parameter '#{param.name}' is already set on #{self}"
if current.source.to_s != ""
- msg += " by %s" % current.source
+ msg += " by #{current.source}"
end
if current.file or current.line
fields = []
fields << current.file if current.file
fields << current.line.to_s if current.line
- msg += " at %s" % fields.join(":")
+ msg += " at #{fields.join(":")}"
end
msg += "; cannot redefine"
raise Puppet::ParseError.new(msg, param.line, param.file)
@@ -331,7 +331,7 @@ class Puppet::Parser::Resource < Puppet::Resource
params.each do |param|
# Don't set the same parameter twice
if @parameters[param.name]
- self.fail Puppet::ParseError, "Duplicate parameter '%s' for on %s" % [param.name, self.to_s]
+ self.fail Puppet::ParseError, "Duplicate parameter '#{param.name}' for on #{self}"
end
set_parameter(param)
diff --git a/lib/puppet/parser/resource/param.rb b/lib/puppet/parser/resource/param.rb
index 26b067703..3514f1d0c 100644
--- a/lib/puppet/parser/resource/param.rb
+++ b/lib/puppet/parser/resource/param.rb
@@ -22,6 +22,6 @@ class Puppet::Parser::Resource::Param
end
def to_s
- "%s => %s" % [self.name, self.value]
+ "#{self.name} => #{self.value}"
end
end
diff --git a/lib/puppet/parser/scope.rb b/lib/puppet/parser/scope.rb
index d9ea3cc8f..02dd3e733 100644
--- a/lib/puppet/parser/scope.rb
+++ b/lib/puppet/parser/scope.rb
@@ -142,7 +142,7 @@ class Puppet::Parser::Scope
if self.respond_to? method
self.send(method, val)
else
- raise Puppet::DevError, "Invalid scope argument %s" % name
+ raise Puppet::DevError, "Invalid scope argument #{name}"
end
}
@@ -227,11 +227,11 @@ class Puppet::Parser::Scope
klassname = parts.join("::")
klass = find_hostclass(klassname)
unless klass
- warning "Could not look up qualified variable '%s'; class %s could not be found" % [name, klassname]
+ warning "Could not look up qualified variable '#{name}'; class #{klassname} could not be found"
return usestring ? "" : :undefined
end
unless kscope = class_scope(klass)
- warning "Could not look up qualified variable '%s'; class %s has not been evaluated" % [name, klassname]
+ warning "Could not look up qualified variable '#{name}'; class #{klassname} has not been evaluated"
return usestring ? "" : :undefined
end
return kscope.lookupvar(shortname, usestring)
@@ -320,7 +320,7 @@ class Puppet::Parser::Scope
#Puppet.debug "Default for %s is %s => %s" %
# [type,ary[0].inspect,ary[1].inspect]
if table.include?(param.name)
- raise Puppet::ParseError.new("Default already defined for %s { %s }; cannot redefine" % [type, param.name], param.line, param.file)
+ raise Puppet::ParseError.new("Default already defined for #{type} { #{param.name} }; cannot redefine", param.line, param.file)
end
table[param.name] = param
}
@@ -335,9 +335,9 @@ class Puppet::Parser::Scope
# [name.inspect,value,self.level, append]
if table.include?(name)
unless options[:append]
- error = Puppet::ParseError.new("Cannot reassign variable %s" % name)
+ error = Puppet::ParseError.new("Cannot reassign variable #{name}")
else
- error = Puppet::ParseError.new("Cannot append, variable %s is defined in this scope" % name)
+ error = Puppet::ParseError.new("Cannot append, variable #{name} is defined in this scope")
end
if options[:file]
error.file = options[:file]
@@ -400,10 +400,10 @@ class Puppet::Parser::Scope
else
str = "Unrecognised escape sequence '#{ss.matched}'"
if file
- str += " in file %s" % file
+ str += " in file #{file}"
end
if line
- str += " at line %s" % line
+ str += " at line #{line}"
end
Puppet.warning str
out << ss.matched
@@ -416,7 +416,7 @@ class Puppet::Parser::Scope
tmp = ss.scan(/[^\\$]+/)
# Puppet.debug("Got other: pos:%d; m:%s" % [ss.pos, tmp])
unless tmp
- error = Puppet::ParseError.new("Could not parse string %s" % string.inspect)
+ error = Puppet::ParseError.new("Could not parse string #{string.inspect}")
{:file= => file, :line= => line}.each do |m,v|
error.send(m, v) if v
end
@@ -438,7 +438,7 @@ class Puppet::Parser::Scope
# Used mainly for logging
def to_s
- "Scope(%s)" % @resource.to_s
+ "Scope(#{@resource})"
end
# Undefine a variable; only used for testing.
diff --git a/lib/puppet/parser/templatewrapper.rb b/lib/puppet/parser/templatewrapper.rb
index 61c74e970..36dc62261 100644
--- a/lib/puppet/parser/templatewrapper.rb
+++ b/lib/puppet/parser/templatewrapper.rb
@@ -62,13 +62,13 @@ class Puppet::Parser::TemplateWrapper
else
# Just throw an error immediately, instead of searching for
# other missingmethod things or whatever.
- raise Puppet::ParseError, "Could not find value for '%s'" % name
+ raise Puppet::ParseError, "Could not find value for '#{name}'"
end
end
def file=(filename)
unless @file = Puppet::Parser::Files.find_template(filename, scope.compiler.environment.to_s)
- raise Puppet::ParseError, "Could not find template '%s'" % filename
+ raise Puppet::ParseError, "Could not find template '#{filename}'"
end
# We'll only ever not have a parser in testing, but, eh.
@@ -109,6 +109,6 @@ class Puppet::Parser::TemplateWrapper
end
def to_s
- "template[%s]" % (file ? file : "inline")
+ "template[#{(file ? file : "inline")}]"
end
end
diff --git a/lib/puppet/parser/type_loader.rb b/lib/puppet/parser/type_loader.rb
index 5f779cb8d..e0b4143fc 100644
--- a/lib/puppet/parser/type_loader.rb
+++ b/lib/puppet/parser/type_loader.rb
@@ -99,7 +99,7 @@ class Puppet::Parser::TypeLoader
return [name.sub(/^::/, '').gsub("::", File::SEPARATOR)] if name =~ /^::/
result = namespaces.inject([]) do |names_to_try, namespace|
- fullname = (namespace + "::" + name).sub(/^::/, '')
+ fullname = (namespace + "::#{name}").sub(/^::/, '')
# Try to load the module init file if we're a qualified name
if fullname.include?("::")
diff --git a/lib/puppet/property/ensure.rb b/lib/puppet/property/ensure.rb
index 2b1d1d433..d6aa99ef3 100644
--- a/lib/puppet/property/ensure.rb
+++ b/lib/puppet/property/ensure.rb
@@ -49,12 +49,12 @@ class Puppet::Property::Ensure < Puppet::Property
elsif newvalue == :absent
return "removed"
else
- return "%s changed '%s' to '%s'" % [self.name, self.is_to_s(currentvalue), self.should_to_s(newvalue)]
+ return "#{self.name} changed '#{self.is_to_s(currentvalue)}' to '#{self.should_to_s(newvalue)}'"
end
rescue Puppet::Error, Puppet::DevError
raise
rescue => detail
- raise Puppet::DevError, "Could not convert change %s to string: %s" % [self.name, detail]
+ raise Puppet::DevError, "Could not convert change #{self.name} to string: #{detail}"
end
end
@@ -69,7 +69,7 @@ class Puppet::Property::Ensure < Puppet::Property
elsif @resource.respond_to?(:exists?)
result = @resource.exists?
else
- raise Puppet::DevError, "No ability to determine if %s exists" % @resource.class.name
+ raise Puppet::DevError, "No ability to determine if #{@resource.class.name} exists"
end
if result
return :present
diff --git a/lib/puppet/provider.rb b/lib/puppet/provider.rb
index b68602aae..ed7142e51 100644
--- a/lib/puppet/provider.rb
+++ b/lib/puppet/provider.rb
@@ -40,7 +40,7 @@ class Puppet::Provider
elsif superclass.respond_to? :command and command = superclass.command(name)
# nothing
else
- raise Puppet::DevError, "No command %s defined for provider %s" % [name, self.name]
+ raise Puppet::DevError, "No command #{name} defined for provider #{self.name}"
end
return binary(command)
@@ -102,7 +102,7 @@ class Puppet::Provider
# The method for returning a list of provider instances. Note that it returns providers, preferably with values already
# filled in, not resources.
def self.instances
- raise Puppet::DevError, "Provider %s has not defined the 'instances' class method" % self.name
+ raise Puppet::DevError, "Provider #{self.name} has not defined the 'instances' class method"
end
# Create the methods for a given command.
@@ -111,7 +111,7 @@ class Puppet::Provider
unless singleton_class.method_defined?(name)
meta_def(name) do |*args|
unless command(name)
- raise Puppet::Error, "Command %s is missing" % name
+ raise Puppet::Error, "Command #{name} is missing"
end
if args.empty?
cmd = [command(name)]
@@ -190,7 +190,7 @@ class Puppet::Provider
klass = param
else
unless klass = resource_type.attrclass(param)
- raise Puppet::DevError, "'%s' is not a valid parameter for %s" % [param, resource_type.name]
+ raise Puppet::DevError, "'#{param}' is not a valid parameter for #{resource_type.name}"
end
end
return true unless features = klass.required_features
@@ -205,9 +205,9 @@ class Puppet::Provider
# def self.to_s
# unless defined?(@str)
# if self.resource_type
-# @str = "%s provider %s" % [resource_type.name, self.name]
+# @str = "#{resource_type.name} provider #{self.name}"
# else
-# @str = "unattached provider %s" % [self.name]
+# @str = "unattached provider #{self.name}"
# end
# end
# @str
@@ -274,7 +274,7 @@ class Puppet::Provider
elsif self.resource
resource.name
else
- raise Puppet::DevError, "No resource and no name in property hash in %s instance" % self.class.name
+ raise Puppet::DevError, "No resource and no name in property hash in #{self.class.name} instance"
end
end
@@ -286,7 +286,7 @@ class Puppet::Provider
end
def to_s
- "%s(provider=%s)" % [@resource.to_s, self.class.name]
+ "#{@resource}(provider=#{self.class.name})"
end
end
diff --git a/lib/puppet/provider/confine.rb b/lib/puppet/provider/confine.rb
index ff97831ee..12d8f245e 100644
--- a/lib/puppet/provider/confine.rb
+++ b/lib/puppet/provider/confine.rb
@@ -13,7 +13,7 @@ class Puppet::Provider::Confine
def self.inherited(klass)
name = klass.to_s.split("::").pop.downcase.to_sym
- raise "Test %s is already defined" % name if @tests.include?(name)
+ raise "Test #{name} is already defined" if @tests.include?(name)
klass.name = name
@@ -23,10 +23,10 @@ class Puppet::Provider::Confine
def self.test(name)
unless @tests[name]
begin
- require "puppet/provider/confine/%s" % name
+ require "puppet/provider/confine/#{name}"
rescue LoadError => detail
unless detail.to_s =~ /No such file/i
- warn "Could not load confine test '%s': %s" % [name, detail]
+ warn "Could not load confine test '#{name}': #{detail}"
end
# Could not find file
end
diff --git a/lib/puppet/provider/confine/exists.rb b/lib/puppet/provider/confine/exists.rb
index 1d1ed8c84..27c404acb 100644
--- a/lib/puppet/provider/confine/exists.rb
+++ b/lib/puppet/provider/confine/exists.rb
@@ -13,7 +13,7 @@ class Puppet::Provider::Confine::Exists < Puppet::Provider::Confine
end
def message(value)
- "file %s does not exist" % value
+ "file #{value} does not exist"
end
def summary
diff --git a/lib/puppet/provider/confine/feature.rb b/lib/puppet/provider/confine/feature.rb
index 1d92b001a..8cd5daaec 100644
--- a/lib/puppet/provider/confine/feature.rb
+++ b/lib/puppet/provider/confine/feature.rb
@@ -11,7 +11,7 @@ class Puppet::Provider::Confine::Feature < Puppet::Provider::Confine
end
def message(value)
- "feature %s is missing" % value
+ "feature #{value} is missing"
end
end
diff --git a/lib/puppet/provider/confine/variable.rb b/lib/puppet/provider/confine/variable.rb
index 8067ae954..0a5cc2960 100644
--- a/lib/puppet/provider/confine/variable.rb
+++ b/lib/puppet/provider/confine/variable.rb
@@ -30,7 +30,7 @@ class Puppet::Provider::Confine::Variable < Puppet::Provider::Confine
end
def message(value)
- "facter value '%s' for '%s' not in required list '%s'" % [test_value, self.name, values.join(",")]
+ "facter value '#{test_value}' for '#{self.name}' not in required list '#{values.join(",")}'"
end
# Compare the passed-in value to the retrieved value.
diff --git a/lib/puppet/provider/cron/crontab.rb b/lib/puppet/provider/cron/crontab.rb
index c7ccd190f..5f2999fa2 100755
--- a/lib/puppet/provider/cron/crontab.rb
+++ b/lib/puppet/provider/cron/crontab.rb
@@ -67,7 +67,7 @@ tab = case Facter.value(:operatingsystem)
def to_line(record)
str = ""
if record[:name]
- str = "# Puppet Name: %s\n" % record[:name]
+ str = "# Puppet Name: #{record[:name]}\n"
end
if record[:environment] and record[:environment] != :absent and record[:environment] != [:absent]
record[:environment].each do |env|
@@ -76,7 +76,7 @@ tab = case Facter.value(:operatingsystem)
end
if record[:special]
- str += "@%s %s" % [record[:special], record[:command]]
+ str += "@#{record[:special]} #{record[:command]}"
else
str += join(record)
end
diff --git a/lib/puppet/provider/file/posix.rb b/lib/puppet/provider/file/posix.rb
index 63d80ead1..a2d102152 100644
--- a/lib/puppet/provider/file/posix.rb
+++ b/lib/puppet/provider/file/posix.rb
@@ -34,7 +34,7 @@ Puppet::Type.type(:file).provide :posix do
if value =~ /^\d+$/
uid = Integer(value)
elsif value.is_a?(String)
- fail "Could not find user %s" % value unless uid = uid(value)
+ fail "Could not find user #{value}" unless uid = uid(value)
else
uid = value
end
@@ -76,7 +76,7 @@ Puppet::Type.type(:file).provide :posix do
# large UIDs instead of negative ones. This isn't a Ruby bug,
# it's an OS X bug, since it shows up in perl, too.
if currentvalue > Puppet[:maximum_uid].to_i
- self.warning "Apparently using negative UID (%s) on a platform that does not consistently handle them" % currentvalue
+ self.warning "Apparently using negative UID (#{currentvalue}) on a platform that does not consistently handle them"
currentvalue = :silly
end
@@ -96,12 +96,12 @@ Puppet::Type.type(:file).provide :posix do
break if uid = validuser?(user)
end
- raise Puppet::Error, "Could not find user(s) %s" % should.join(",") unless uid
+ raise Puppet::Error, "Could not find user(s) #{should.join(",")}" unless uid
begin
File.send(method, uid, nil, path)
rescue => detail
- raise Puppet::Error, "Failed to set owner to '%s': %s" % [uid, detail]
+ raise Puppet::Error, "Failed to set owner to '#{uid}': #{detail}"
end
return :file_changed
diff --git a/lib/puppet/provider/file/win32.rb b/lib/puppet/provider/file/win32.rb
index da6db1e8c..d2b392104 100644
--- a/lib/puppet/provider/file/win32.rb
+++ b/lib/puppet/provider/file/win32.rb
@@ -21,7 +21,7 @@ Puppet::Type.type(:file).provide :microsoft_windows do
if value =~ /^\d+$/
uid = Integer(value)
elsif value.is_a?(String)
- fail "Could not find user %s" % value unless uid = uid(value)
+ fail "Could not find user #{value}" unless uid = uid(value)
else
uid = value
end
@@ -39,7 +39,7 @@ Puppet::Type.type(:file).provide :microsoft_windows do
# Determine if the user is valid, and if so, return the UID
def validuser?(value)
- info "Is '%s' a valid user?" % value
+ info "Is '#{value}' a valid user?"
return 0
begin
number = Integer(value)
@@ -65,7 +65,7 @@ Puppet::Type.type(:file).provide :microsoft_windows do
# large UIDs instead of negative ones. This isn't a Ruby bug,
# it's an OS X bug, since it shows up in perl, too.
if currentvalue > Puppet[:maximum_uid].to_i
- self.warning "Apparently using negative UID (%s) on a platform that does not consistently handle them" % currentvalue
+ self.warning "Apparently using negative UID (#{currentvalue}) on a platform that does not consistently handle them"
currentvalue = :silly
end
diff --git a/lib/puppet/provider/group/ldap.rb b/lib/puppet/provider/group/ldap.rb
index 6d5f663ed..87d62d53a 100644
--- a/lib/puppet/provider/group/ldap.rb
+++ b/lib/puppet/provider/group/ldap.rb
@@ -40,7 +40,7 @@ Puppet::Type.type(:group).provide :ldap, :parent => Puppet::Provider::Ldap do
# Convert a group name to an id.
def self.name2id(group)
- return nil unless result = manager.search("cn=%s" % group) and result.length > 0
+ return nil unless result = manager.search("cn=#{group}") and result.length > 0
# Only use the first result.
group = result[0]
diff --git a/lib/puppet/provider/host/parsed.rb b/lib/puppet/provider/host/parsed.rb
index f4282c5a6..7c824ac9b 100644
--- a/lib/puppet/provider/host/parsed.rb
+++ b/lib/puppet/provider/host/parsed.rb
@@ -42,7 +42,7 @@ end
end
end
else
- raise Puppet::Error, "Could not match '%s'" % line
+ raise Puppet::Error, "Could not match '#{line}'"
end
if hash[:host_aliases] == ""
@@ -57,15 +57,15 @@ end
return super unless hash[:record_type] == :parsed
[:ip, :name].each do |n|
unless hash[n] and hash[n] != :absent
- raise ArgumentError, "%s is a required attribute for hosts" % n
+ raise ArgumentError, "#{n} is a required attribute for hosts"
end
end
- str = "%s\t%s" % [hash[:ip], hash[:name]]
+ str = "#{hash[:ip]}\t#{hash[:name]}"
if hash.include? :host_aliases and !hash[:host_aliases].empty?
if hash[:host_aliases].is_a? Array
- str += "\t%s" % hash[:host_aliases].join("\t")
+ str += "\t#{hash[:host_aliases].join("\t")}"
else
raise ArgumentError, "Host aliases must be specified as an array"
end
diff --git a/lib/puppet/provider/ldap.rb b/lib/puppet/provider/ldap.rb
index 38668e5e5..098daa6ab 100644
--- a/lib/puppet/provider/ldap.rb
+++ b/lib/puppet/provider/ldap.rb
@@ -70,8 +70,8 @@ class Puppet::Provider::Ldap < Puppet::Provider
end
def initialize(*args)
- raise(Puppet::DevError, "No LDAP Configuration defined for %s" % self.class) unless self.class.manager
- raise(Puppet::DevError, "Invalid LDAP Configuration defined for %s" % self.class) unless self.class.manager.valid?
+ raise(Puppet::DevError, "No LDAP Configuration defined for #{self.class}") unless self.class.manager
+ raise(Puppet::DevError, "Invalid LDAP Configuration defined for #{self.class}") unless self.class.manager.valid?
super
@property_hash = @property_hash.inject({}) do |result, ary|
diff --git a/lib/puppet/provider/mailalias/aliases.rb b/lib/puppet/provider/mailalias/aliases.rb
index 5b7f0e2ec..f946e13df 100755
--- a/lib/puppet/provider/mailalias/aliases.rb
+++ b/lib/puppet/provider/mailalias/aliases.rb
@@ -37,7 +37,7 @@ require 'puppet/provider/parsedfile'
d
end
end.join(",")
- return "%s: %s" % [record[:name], dest]
+ return "#{record[:name]}: #{dest}"
end
end
end
diff --git a/lib/puppet/provider/maillist/mailman.rb b/lib/puppet/provider/maillist/mailman.rb
index 51b7fa34b..5e60b20f1 100755
--- a/lib/puppet/provider/maillist/mailman.rb
+++ b/lib/puppet/provider/maillist/mailman.rb
@@ -37,7 +37,7 @@ Puppet::Type.type(:maillist).provide(:mailman) do
name = self.name.downcase
aliases = {name => "| #{mailman} post #{name}"}
%w{admin bounces confirm join leave owner request subscribe unsubscribe}.each do |address|
- aliases["%s-%s" % [name, address]] = "| %s %s %s" % [mailman, address, name]
+ aliases["#{name}-#{address}"] = "| #{mailman} #{address} #{name}"
end
aliases
end
diff --git a/lib/puppet/provider/naginator.rb b/lib/puppet/provider/naginator.rb
index 5510eb9c8..592eb43fd 100644
--- a/lib/puppet/provider/naginator.rb
+++ b/lib/puppet/provider/naginator.rb
@@ -13,7 +13,7 @@ class Puppet::Provider::Naginator < Puppet::Provider::ParsedFile
unless defined?(@nagios_type) and @nagios_type
name = resource_type.name.to_s.sub(/^nagios_/, '')
unless @nagios_type = Nagios::Base.type(name.to_sym)
- raise Puppet::DevError, "Could not find nagios type '%s'" % name
+ raise Puppet::DevError, "Could not find nagios type '#{name}'"
end
# And add our 'ensure' settings, since they aren't a part of
@@ -27,7 +27,7 @@ class Puppet::Provider::Naginator < Puppet::Provider::ParsedFile
begin
Nagios::Parser.new.parse(text.gsub(NAME_STRING, "_naginator_name"))
rescue => detail
- raise Puppet::Error, "Could not parse configuration for %s: %s" % [resource_type.name, detail]
+ raise Puppet::Error, "Could not parse configuration for #{resource_type.name}: #{detail}"
end
end
diff --git a/lib/puppet/provider/nameservice.rb b/lib/puppet/provider/nameservice.rb
index 8a759e4f3..dace6b512 100644
--- a/lib/puppet/provider/nameservice.rb
+++ b/lib/puppet/provider/nameservice.rb
@@ -45,7 +45,7 @@ class Puppet::Provider::NameService < Puppet::Provider
def options(name, hash)
unless resource_type.valid_parameter?(name)
- raise Puppet::DevError, "%s is not a valid attribute for %s" % [name, resource_type.name]
+ raise Puppet::DevError, "#{name} is not a valid attribute for #{resource_type.name}"
end
@options ||= {}
@options[name] ||= {}
@@ -61,16 +61,16 @@ class Puppet::Provider::NameService < Puppet::Provider
# for both users and groups.
def listbyname
names = []
- Etc.send("set%sent" % section())
+ Etc.send("set#{section()}ent")
begin
- while ent = Etc.send("get%sent" % section())
+ while ent = Etc.send("get#{section()}ent")
names << ent.name
if block_given?
yield ent.name
end
end
ensure
- Etc.send("end%sent" % section())
+ Etc.send("end#{section()}ent")
end
return names
@@ -110,7 +110,7 @@ class Puppet::Provider::NameService < Puppet::Provider
if @checks.include? name
block = @checks[name][:block]
unless block.call(value)
- raise ArgumentError, "Invalid value %s: %s" % [value, @checks[name][:error]]
+ raise ArgumentError, "Invalid value #{value}: #{@checks[name][:error]}"
end
end
end
@@ -123,7 +123,7 @@ class Puppet::Provider::NameService < Puppet::Provider
private
def op(property)
- @ops[property.name] || ("-" + property.name)
+ @ops[property.name] || ("-#{property.name}")
end
end
@@ -137,8 +137,8 @@ class Puppet::Provider::NameService < Puppet::Provider
else
if value = self.class.autogen_default(field)
return value
- elsif respond_to?("autogen_%s" % [field])
- return send("autogen_%s" % field)
+ elsif respond_to?("autogen_#{field}")
+ return send("autogen_#{field}")
else
return nil
end
@@ -155,7 +155,7 @@ class Puppet::Provider::NameService < Puppet::Provider
when :user; group = :passwd; method = :uid
when :group; group = :group; method = :gid
else
- raise Puppet::DevError, "Invalid resource name %s" % resource
+ raise Puppet::DevError, "Invalid resource name #{resource}"
end
# Make sure we don't use the same value multiple times
@@ -186,7 +186,7 @@ class Puppet::Provider::NameService < Puppet::Provider
begin
execute(self.addcmd)
rescue Puppet::ExecutionFailure => detail
- raise Puppet::Error, "Could not create %s %s: %s" % [@resource.class.name, @resource.name, detail]
+ raise Puppet::Error, "Could not create #{@resource.class.name} #{@resource.name}: #{detail}"
end
end
@@ -200,7 +200,7 @@ class Puppet::Provider::NameService < Puppet::Provider
begin
execute(self.deletecmd)
rescue Puppet::ExecutionFailure => detail
- raise Puppet::Error, "Could not delete %s %s: %s" % [@resource.class.name, @resource.name, detail]
+ raise Puppet::Error, "Could not delete #{@resource.class.name} #{@resource.name}: #{detail}"
end
end
@@ -304,7 +304,7 @@ class Puppet::Provider::NameService < Puppet::Provider
begin
execute(cmd)
rescue Puppet::ExecutionFailure => detail
- raise Puppet::Error, "Could not set %s on %s[%s]: %s" % [param, @resource.class.name, @resource.name, detail]
+ raise Puppet::Error, "Could not set #{param} on #{@resource.class.name}[#{@resource.name}]: #{detail}"
end
end
end
diff --git a/lib/puppet/provider/nameservice/directoryservice.rb b/lib/puppet/provider/nameservice/directoryservice.rb
index 1eb0aec6c..251f496d5 100644
--- a/lib/puppet/provider/nameservice/directoryservice.rb
+++ b/lib/puppet/provider/nameservice/directoryservice.rb
@@ -123,12 +123,12 @@ class DirectoryService < Puppet::Provider::NameService
product_version_major = product_version.scan(/(\d+)\.(\d+)./).join(".")
end
if %w{10.0 10.1 10.2 10.3}.include?(product_version_major)
- fail("%s is not supported by the directoryservice provider" % product_version_major)
+ fail("#{product_version_major} is not supported by the directoryservice provider")
end
@macosx_version_major = product_version_major
return @macosx_version_major
rescue Puppet::ExecutionFailure => detail
- fail("Could not determine OS X version: %s" % detail)
+ fail("Could not determine OS X version: #{detail}")
end
end
@@ -138,7 +138,7 @@ class DirectoryService < Puppet::Provider::NameService
begin
dscl_output = execute(get_exec_preamble("-list"))
rescue Puppet::ExecutionFailure => detail
- fail("Could not get %s list from DirectoryService" % [ @resource_type.name.to_s ])
+ fail("Could not get #{@resource_type.name} list from DirectoryService")
end
return dscl_output.split("\n")
end
@@ -279,9 +279,9 @@ class DirectoryService < Puppet::Provider::NameService
# JJM: get_ds_path will spit back "Users" or "Groups",
# etc... Depending on the Puppet::Type of our self.
if resource_name
- command_vector << "/%s/%s" % [ get_ds_path, resource_name ]
+ command_vector << "/#{get_ds_path}/#{resource_name}"
else
- command_vector << "/%s" % [ get_ds_path ]
+ command_vector << "/#{get_ds_path}"
end
# JJM: This returns most of the preamble of the command.
# e.g. 'dscl / -create /Users/mccune'
@@ -368,7 +368,7 @@ class DirectoryService < Puppet::Provider::NameService
guid = guid_plist["dsAttrTypeStandard:#{@@ns_to_ds_attribute_map[:guid]}"][0]
self.class.set_password(@resource.name, guid, passphrase)
rescue Puppet::ExecutionFailure => detail
- fail("Could not set %s on %s[%s]: %s" % [param, @resource.class.name, @resource.name, detail])
+ fail("Could not set #{param} on #{@resource.class.name}[#{@resource.name}]: #{detail}")
end
end
@@ -399,7 +399,7 @@ class DirectoryService < Puppet::Provider::NameService
begin
execute(exec_arg_vector)
rescue Puppet::ExecutionFailure => detail
- fail("Could not set %s on %s[%s]: %s" % [param, @resource.class.name, @resource.name, detail])
+ fail("Could not set #{param} on #{@resource.class.name}[#{@resource.name}]: #{detail}")
end
end
end
@@ -426,7 +426,7 @@ class DirectoryService < Puppet::Provider::NameService
begin
execute(exec_arg_vector)
rescue Puppet::ExecutionFailure => detail
- fail("Could not set GeneratedUID for %s %s: %s" % [@resource.class.name, @resource.name, detail])
+ fail("Could not set GeneratedUID for #{@resource.class.name} #{@resource.name}: #{detail}")
end
if value = @resource.should(:password) and value != ""
@@ -447,7 +447,7 @@ class DirectoryService < Puppet::Provider::NameService
begin
execute(exec_arg_vector)
rescue Puppet::ExecutionFailure => detail
- fail("Could not create %s %s: %s" % [@resource.class.name, @resource.name, detail])
+ fail("Could not create #{@resource.class.name} #{@resource.name}: #{detail}")
end
end
end
@@ -461,7 +461,7 @@ class DirectoryService < Puppet::Provider::NameService
begin
execute(cmd)
rescue Puppet::ExecutionFailure => detail
- fail("Could not remove %s from group: %s, %s" % [member, @resource.name, detail])
+ fail("Could not remove #{member} from group: #{@resource.name}, #{detail}")
end
end
end
@@ -474,7 +474,7 @@ class DirectoryService < Puppet::Provider::NameService
begin
execute(cmd)
rescue Puppet::ExecutionFailure => detail
- fail("Could not add %s to group: %s, %s" % [new_member, @resource.name, detail])
+ fail("Could not add #{new_member} to group: #{@resource.name}, #{detail}")
end
end
end
diff --git a/lib/puppet/provider/package/aix.rb b/lib/puppet/provider/package/aix.rb
index 385d33fac..7523b776d 100644
--- a/lib/puppet/provider/package/aix.rb
+++ b/lib/puppet/provider/package/aix.rb
@@ -95,7 +95,7 @@ Puppet::Type.type(:package).provide :aix, :parent => Puppet::Provider::Package d
if hash[:pkgname]
return nil
else
- raise Puppet::Error, "Could not list installed Packages: %s" % detail
+ raise Puppet::Error, "Could not list installed Packages: #{detail}"
end
end
diff --git a/lib/puppet/provider/package/apt.rb b/lib/puppet/provider/package/apt.rb
index 9ae2a861e..622e182ea 100755
--- a/lib/puppet/provider/package/apt.rb
+++ b/lib/puppet/provider/package/apt.rb
@@ -65,7 +65,7 @@ Puppet::Type.type(:package).provide :apt, :parent => :dpkg, :source => :dpkg do
# pass
else
# Add the package version and --force-yes option
- str += "=%s" % should
+ str += "=#{should}"
cmd << "--force-yes"
end
@@ -91,7 +91,7 @@ Puppet::Type.type(:package).provide :apt, :parent => :dpkg, :source => :dpkg do
#
def run_preseed
if response = @resource[:responsefile] and FileTest.exist?(response)
- self.info("Preseeding %s to debconf-set-selections" % response)
+ self.info("Preseeding #{response} to debconf-set-selections")
preseed response
else
diff --git a/lib/puppet/provider/package/aptitude.rb b/lib/puppet/provider/package/aptitude.rb
index 0842856c1..607f8c0dc 100755
--- a/lib/puppet/provider/package/aptitude.rb
+++ b/lib/puppet/provider/package/aptitude.rb
@@ -19,7 +19,7 @@ Puppet::Type.type(:package).provide :aptitude, :parent => :apt, :source => :dpkg
# Yay, stupid aptitude doesn't throw an error when the package is missing.
if args.include?(:install) and output =~ /Couldn't find any package/
raise Puppet::Error.new(
- "Could not find package %s" % self.name
+ "Could not find package #{self.name}"
)
end
end
diff --git a/lib/puppet/provider/package/aptrpm.rb b/lib/puppet/provider/package/aptrpm.rb
index 4b3841d88..a3ad3b447 100644
--- a/lib/puppet/provider/package/aptrpm.rb
+++ b/lib/puppet/provider/package/aptrpm.rb
@@ -31,7 +31,7 @@ Puppet::Type.type(:package).provide :aptrpm, :parent => :rpm, :source => :rpm do
# pass
else
# Add the package version
- str += "=%s" % should
+ str += "=#{should}"
end
cmd = %w{-q -y}
@@ -50,7 +50,7 @@ Puppet::Type.type(:package).provide :aptrpm, :parent => :rpm, :source => :rpm do
if version =~ /^([^\(]+)\(/
$1
else
- self.warning "Could not match version '%s'" % version
+ self.warning "Could not match version '#{version}'"
nil
end
}.reject { |vers| vers.nil? }.sort { |a,b|
diff --git a/lib/puppet/provider/package/blastwave.rb b/lib/puppet/provider/package/blastwave.rb
index 9b2bbf6a5..ee1e8f73a 100755
--- a/lib/puppet/provider/package/blastwave.rb
+++ b/lib/puppet/provider/package/blastwave.rb
@@ -83,7 +83,7 @@ Puppet::Type.type(:package).provide :blastwave, :parent => :sun, :source => :sun
return hash
else
- Puppet.warning "Cannot match %s" % line
+ Puppet.warning "Cannot match #{line}"
return nil
end
end
diff --git a/lib/puppet/provider/package/darwinport.rb b/lib/puppet/provider/package/darwinport.rb
index 5cced62d5..2153d2f83 100755
--- a/lib/puppet/provider/package/darwinport.rb
+++ b/lib/puppet/provider/package/darwinport.rb
@@ -27,7 +27,7 @@ Puppet::Type.type(:package).provide :darwinport, :parent => Puppet::Provider::Pa
yield hash.dup
else
raise Puppet::DevError,
- "Failed to match dpkg line %s" % line
+ "Failed to match dpkg line #{line}"
end
}
}
@@ -49,7 +49,7 @@ Puppet::Type.type(:package).provide :darwinport, :parent => Puppet::Provider::Pa
# Seems like you can always say 'upgrade'
output = port "upgrade", @resource[:name]
if output =~ /^Error: No port/
- raise Puppet::ExecutionFailure, "Could not find package %s" % @resource[:name]
+ raise Puppet::ExecutionFailure, "Could not find package #{@resource[:name]}"
end
end
diff --git a/lib/puppet/provider/package/dpkg.rb b/lib/puppet/provider/package/dpkg.rb
index aaa277944..3c3141b4f 100755
--- a/lib/puppet/provider/package/dpkg.rb
+++ b/lib/puppet/provider/package/dpkg.rb
@@ -16,7 +16,7 @@ Puppet::Type.type(:package).provide :dpkg, :parent => Puppet::Provider::Package
# list out all of the packages
cmd = "#{command(:dpkgquery)} -W --showformat '${Status} ${Package} ${Version}\\n'"
- Puppet.debug "Executing '%s'" % cmd
+ Puppet.debug "Executing '#{cmd}'"
execpipe(cmd) do |process|
# our regex for matching dpkg output
regex = %r{^(\S+) +(\S+) +(\S+) (\S+) (\S*)$}
@@ -56,7 +56,7 @@ Puppet::Type.type(:package).provide :dpkg, :parent => Puppet::Provider::Package
hash[:ensure] = :held
end
else
- Puppet.warning "Failed to match dpkg-query line %s" % line.inspect
+ Puppet.warning "Failed to match dpkg-query line #{line.inspect}"
return nil
end
@@ -92,7 +92,7 @@ Puppet::Type.type(:package).provide :dpkg, :parent => Puppet::Provider::Package
output = dpkg_deb "--show", @resource[:source]
matches = /^(\S+)\t(\S+)$/.match(output).captures
unless matches[0].match( Regexp.escape(@resource[:name]) )
- warning "source doesn't contain named package, but %s" % matches[0]
+ warning "source doesn't contain named package, but #{matches[0]}"
end
matches[1]
end
@@ -122,7 +122,7 @@ Puppet::Type.type(:package).provide :dpkg, :parent => Puppet::Provider::Package
if hash[:error] != "ok"
raise Puppet::Error.new(
- "Package %s, version %s is in error state: %s" % [hash[:name], hash[:ensure], hash[:error]]
+ "Package #{hash[:name]}, version #{hash[:ensure]} is in error state: #{hash[:error]}"
)
end
diff --git a/lib/puppet/provider/package/fink.rb b/lib/puppet/provider/package/fink.rb
index d859c0e32..3f0d79475 100755
--- a/lib/puppet/provider/package/fink.rb
+++ b/lib/puppet/provider/package/fink.rb
@@ -33,7 +33,7 @@ Puppet::Type.type(:package).provide :fink, :parent => :dpkg, :source => :dpkg do
# pass
else
# Add the package version
- str += "=%s" % should
+ str += "=#{should}"
end
cmd = %w{-b -q -y}
@@ -61,7 +61,7 @@ Puppet::Type.type(:package).provide :fink, :parent => :dpkg, :source => :dpkg do
#
def run_preseed
if response = @resource[:responsefile] and FileTest.exists?(response)
- self.info("Preseeding %s to debconf-set-selections" % response)
+ self.info("Preseeding #{response} to debconf-set-selections")
preseed response
else
diff --git a/lib/puppet/provider/package/freebsd.rb b/lib/puppet/provider/package/freebsd.rb
index 79316f80f..0c816cdb6 100755
--- a/lib/puppet/provider/package/freebsd.rb
+++ b/lib/puppet/provider/package/freebsd.rb
@@ -30,7 +30,7 @@ Puppet::Type.type(:package).provide :freebsd, :parent => :openbsd do
end
else
if @resource[:source]
- Puppet.warning "source is defined but does not have trailing slash, ignoring %s" % @resource[:source]
+ Puppet.warning "source is defined but does not have trailing slash, ignoring #{@resource[:source]}"
end
pkgadd "-r", @resource[:name]
end
@@ -46,7 +46,7 @@ Puppet::Type.type(:package).provide :freebsd, :parent => :openbsd do
end
def uninstall
- pkgdelete "%s-%s" % [@resource[:name], @resource.should(:ensure)]
+ pkgdelete "#{@resource[:name]}-#{@resource.should(:ensure)}"
end
end
diff --git a/lib/puppet/provider/package/gem.rb b/lib/puppet/provider/package/gem.rb
index 9dca08d5c..1c345097f 100755
--- a/lib/puppet/provider/package/gem.rb
+++ b/lib/puppet/provider/package/gem.rb
@@ -35,7 +35,7 @@ Puppet::Type.type(:package).provide :gem, :parent => Puppet::Provider::Package d
end
end.compact
rescue Puppet::ExecutionFailure => detail
- raise Puppet::Error, "Could not list gems: %s" % detail
+ raise Puppet::Error, "Could not list gems: #{detail}"
end
if hash[:justme]
@@ -56,7 +56,7 @@ Puppet::Type.type(:package).provide :gem, :parent => Puppet::Provider::Package d
:ensure => version
}
else
- Puppet.warning "Could not match %s" % desc
+ Puppet.warning "Could not match #{desc}"
nil
end
end
@@ -79,7 +79,7 @@ Puppet::Type.type(:package).provide :gem, :parent => Puppet::Provider::Package d
begin
uri = URI.parse(source)
rescue => detail
- fail "Invalid source '%s': %s" % [uri, detail]
+ fail "Invalid source '#{uri}': #{detail}"
end
case uri.scheme
@@ -102,7 +102,7 @@ Puppet::Type.type(:package).provide :gem, :parent => Puppet::Provider::Package d
output = execute(command)
# Apparently some stupid gem versions don't exit non-0 on failure
if output.include?("ERROR")
- self.fail "Could not install: %s" % output.chomp
+ self.fail "Could not install: #{output.chomp}"
end
end
diff --git a/lib/puppet/provider/package/openbsd.rb b/lib/puppet/provider/package/openbsd.rb
index 254c9ab61..149b557ae 100755
--- a/lib/puppet/provider/package/openbsd.rb
+++ b/lib/puppet/provider/package/openbsd.rb
@@ -38,7 +38,7 @@ Puppet::Type.type(:package).provide :openbsd, :parent => Puppet::Provider::Packa
else
# Print a warning on lines we can't match, but move
# on, since it should be non-fatal
- warning("Failed to match line %s" % line)
+ warning("Failed to match line #{line}")
end
}
end
diff --git a/lib/puppet/provider/package/pkg.rb b/lib/puppet/provider/package/pkg.rb
index 7d21acb66..c0767a7f0 100644
--- a/lib/puppet/provider/package/pkg.rb
+++ b/lib/puppet/provider/package/pkg.rb
@@ -47,7 +47,7 @@ Puppet::Type.type(:package).provide :pkg, :parent => Puppet::Provider::Package d
hash[:ensure] = :absent
end
else
- Puppet.warning "Failed to match 'pkg list' line %s" % line.inspect
+ Puppet.warning "Failed to match 'pkg list' line #{line.inspect}"
return nil
end
@@ -66,7 +66,7 @@ Puppet::Type.type(:package).provide :pkg, :parent => Puppet::Provider::Package d
when "installed"
version = v
else
- Puppet.warn "unknown package state for %s: %s" % [@resource[:name], v]
+ Puppet.warn "unknown package state for #{@resource[:name]}: #{v}"
end
end
version
@@ -101,7 +101,7 @@ Puppet::Type.type(:package).provide :pkg, :parent => Puppet::Provider::Package d
{:ensure => :absent, :status => 'missing', :name => @resource[:name], :error => 'ok'}
if hash[:error] != "ok"
- raise Puppet::Error.new( "Package %s, version %s is in error state: %s" % [hash[:name], hash[:version], hash[:error]])
+ raise Puppet::Error.new( "Package #{hash[:name]}, version #{hash[:version]} is in error state: #{hash[:error]}")
end
return hash
diff --git a/lib/puppet/provider/package/pkgdmg.rb b/lib/puppet/provider/package/pkgdmg.rb
index 4e9e50802..ac4853d83 100644
--- a/lib/puppet/provider/package/pkgdmg.rb
+++ b/lib/puppet/provider/package/pkgdmg.rb
@@ -93,7 +93,7 @@ Puppet::Type.type(:package).provide :pkgdmg, :parent => Puppet::Provider::Packag
xml_str = hdiutil "mount", "-plist", "-nobrowse", "-readonly", "-noidme", "-mountrandom", "/tmp", dmg.path
hdiutil_info = Plist::parse_xml(xml_str)
unless hdiutil_info.has_key?("system-entities")
- raise Puppet::Error.new("No disk entities returned by mount at %s" % dmg.path)
+ raise Puppet::Error.new("No disk entities returned by mount at #{dmg.path}")
end
mounts = hdiutil_info["system-entities"].collect { |entity|
entity["mount-point"]
diff --git a/lib/puppet/provider/package/portage.rb b/lib/puppet/provider/package/portage.rb
index 5f3a5bd4c..7e1119a1a 100644
--- a/lib/puppet/provider/package/portage.rb
+++ b/lib/puppet/provider/package/portage.rb
@@ -54,14 +54,14 @@ Puppet::Type.type(:package).provide :portage, :parent => Puppet::Provider::Packa
name = package_name
unless should == :present or should == :latest
# We must install a specific version
- name = "=%s-%s" % [name, should]
+ name = "=#{name}-#{should}"
end
emerge name
end
# The common package name format.
def package_name
- @resource[:category] ? "%s/%s" % [@resource[:category], @resource[:name]] : @resource[:name]
+ @resource[:category] ? "#{@resource[:category]}/#{@resource[:name]}" : @resource[:name]
end
def uninstall
@@ -108,7 +108,7 @@ Puppet::Type.type(:package).provide :portage, :parent => Puppet::Provider::Packa
case packages.size
when 0
- not_found_value = "%s/%s" % [@resource[:category] ? @resource[:category] : "<unspecified category>", @resource[:name]]
+ not_found_value = "#{@resource[:category] ? @resource[:category] : "<unspecified category>"}/#{@resource[:name]}"
raise Puppet::Error.new("No package found with the specified name [#{not_found_value}]")
when 1
return packages[0]
diff --git a/lib/puppet/provider/package/ports.rb b/lib/puppet/provider/package/ports.rb
index 16e065ef8..286aca8e1 100755
--- a/lib/puppet/provider/package/ports.rb
+++ b/lib/puppet/provider/package/ports.rb
@@ -22,7 +22,7 @@ Puppet::Type.type(:package).provide :ports, :parent => :freebsd, :source => :fre
output = portupgrade(*cmd)
if output =~ /\*\* No such /
- raise Puppet::ExecutionFailure, "Could not find package %s" % @resource[:name]
+ raise Puppet::ExecutionFailure, "Could not find package #{@resource[:name]}"
end
end
@@ -48,7 +48,7 @@ Puppet::Type.type(:package).provide :ports, :parent => :freebsd, :source => :fre
unless pkgstuff =~ /^(\S+)-([^-\s]+)$/
raise Puppet::Error,
- "Could not match package info '%s'" % pkgstuff
+ "Could not match package info '#{pkgstuff}'"
end
name, version = $1, $2
@@ -62,12 +62,12 @@ Puppet::Type.type(:package).provide :ports, :parent => :freebsd, :source => :fre
unless info =~ /\((\w+) has (.+)\)/
raise Puppet::Error,
- "Could not match version info '%s'" % info
+ "Could not match version info '#{info}'"
end
source, newversion = $1, $2
- debug "Newer version in %s" % source
+ debug "Newer version in #{source}"
return newversion
end
diff --git a/lib/puppet/provider/package/portupgrade.rb b/lib/puppet/provider/package/portupgrade.rb
index acdcab6f7..c3aea98bf 100644
--- a/lib/puppet/provider/package/portupgrade.rb
+++ b/lib/puppet/provider/package/portupgrade.rb
@@ -70,7 +70,7 @@ Puppet::Type.type(:package).provide :portupgrade, :parent => Puppet::Provider::P
else
# unrecognised output from pkg_info
- Puppet.debug "portupgrade.Instances() - unable to match output: %s" % data
+ Puppet.debug "portupgrade.Instances() - unable to match output: #{data}"
end
}
@@ -82,7 +82,7 @@ Puppet::Type.type(:package).provide :portupgrade, :parent => Puppet::Provider::P
######## Installation sub command
def install
- Puppet.debug "portupgrade.install() - Installation call on %s" % @resource[:name]
+ Puppet.debug "portupgrade.install() - Installation call on #{@resource[:name]}"
# -M: yes, we're a batch, so don't ask any questions
cmdline = ["-M BATCH=yes", @resource[:name]]
@@ -94,7 +94,7 @@ Puppet::Type.type(:package).provide :portupgrade, :parent => Puppet::Provider::P
end
if output =~ /\*\* No such /
- raise Puppet::ExecutionFailure, "Could not find package %s" % @resource[:name]
+ raise Puppet::ExecutionFailure, "Could not find package #{@resource[:name]}"
end
# No return code required, so do nil to be clean
@@ -104,7 +104,7 @@ Puppet::Type.type(:package).provide :portupgrade, :parent => Puppet::Provider::P
######## Latest subcommand (returns the latest version available, or current version if installed is latest)
def latest
- Puppet.debug "portupgrade.latest() - Latest check called on %s" % @resource[:name]
+ Puppet.debug "portupgrade.latest() - Latest check called on #{@resource[:name]}"
# search for latest version available, or return current version.
# cmdline = "portversion -v <portorigin>", returns "<portname> <code> <stuff>"
# or "** No matching package found: <portname>"
@@ -128,24 +128,24 @@ Puppet::Type.type(:package).provide :portupgrade, :parent => Puppet::Provider::P
# all others return the current version so no unexpected 'upgrades' occur.
case comparison
when "=", ">"
- Puppet.debug "portupgrade.latest() - Installed package is latest (%s)" % installedversion
+ Puppet.debug "portupgrade.latest() - Installed package is latest (#{installedversion})"
return installedversion
when "<"
# "portpkg-1.7_5 < needs updating (port has 1.14)"
# "portpkg-1.7_5 < needs updating (port has 1.14) (=> 'newport/pkg')
if otherdata =~ /\(port has (\S+)\)/
newversion = $1
- Puppet.debug "portupgrade.latest() - Installed version needs updating to (%s)" % newversion
+ Puppet.debug "portupgrade.latest() - Installed version needs updating to (#{newversion})"
return newversion
else
- Puppet.debug "portupgrade.latest() - Unable to determine new version from (%s)" % otherdata
+ Puppet.debug "portupgrade.latest() - Unable to determine new version from (#{otherdata})"
return installedversion
end
when "?", "!", "#"
- Puppet.debug "portupgrade.latest() - Comparison Error reported from portversion (%s)" % output
+ Puppet.debug "portupgrade.latest() - Comparison Error reported from portversion (#{output})"
return installedversion
else
- Puppet.debug "portupgrade.latest() - Unknown code from portversion output (%s)" % output
+ Puppet.debug "portupgrade.latest() - Unknown code from portversion output (#{output})"
return installedversion
end
@@ -154,10 +154,10 @@ Puppet::Type.type(:package).provide :portupgrade, :parent => Puppet::Provider::P
# Seriously - this section should never be called in a perfect world.
# as verification that the port is installed has already happened in query.
if output =~ /^\*\* No matching package /
- raise Puppet::ExecutionFailure, "Could not find package %s" % @resource[:name]
+ raise Puppet::ExecutionFailure, "Could not find package #{@resource[:name]}"
else
# Any other error (dump output to log)
- raise Puppet::ExecutionFailure, "Unexpected output from portversion: %s" % output
+ raise Puppet::ExecutionFailure, "Unexpected output from portversion: #{output}"
end
# Just in case we still are running, return nil
@@ -166,7 +166,7 @@ Puppet::Type.type(:package).provide :portupgrade, :parent => Puppet::Provider::P
# At this point normal operation has finished and we shouldn't have been called.
# Error out and let the admin deal with it.
- raise Puppet::Error, "portversion.latest() - fatal error with portversion: %s" % output
+ raise Puppet::Error, "portversion.latest() - fatal error with portversion: #{output}"
return nil
end
@@ -175,7 +175,7 @@ Puppet::Type.type(:package).provide :portupgrade, :parent => Puppet::Provider::P
# Used to make sure the package is installed
def query
- Puppet.debug "portupgrade.query() - Called on %s" % @resource[:name]
+ Puppet.debug "portupgrade.query() - Called on #{@resource[:name]}"
cmdline = ["-qO", @resource[:name]]
begin
@@ -198,7 +198,7 @@ Puppet::Type.type(:package).provide :portupgrade, :parent => Puppet::Provider::P
# return the hash to the caller
return hash
else
- Puppet.debug "portupgrade.query() - package (%s) not installed" % @resource[:name]
+ Puppet.debug "portupgrade.query() - package (#{@resource[:name]}) not installed"
return nil
end
@@ -207,7 +207,7 @@ Puppet::Type.type(:package).provide :portupgrade, :parent => Puppet::Provider::P
####### Uninstall command
def uninstall
- Puppet.debug "portupgrade.uninstall() - called on %s" % @resource[:name]
+ Puppet.debug "portupgrade.uninstall() - called on #{@resource[:name]}"
# Get full package name from port origin to uninstall with
cmdline = ["-qO", @resource[:name]]
begin
@@ -226,7 +226,7 @@ Puppet::Type.type(:package).provide :portupgrade, :parent => Puppet::Provider::P
######## Update/upgrade command
def update
- Puppet.debug "portupgrade.update() - called on (%s)" % @resource[:name]
+ Puppet.debug "portupgrade.update() - called on (#{@resource[:name]})"
cmdline = ["-qO", @resource[:name]]
begin
diff --git a/lib/puppet/provider/package/rug.rb b/lib/puppet/provider/package/rug.rb
index 9f09b35fe..227edc7c2 100644
--- a/lib/puppet/provider/package/rug.rb
+++ b/lib/puppet/provider/package/rug.rb
@@ -20,13 +20,13 @@ Puppet::Type.type(:package).provide :rug, :parent => :rpm do
# pass
else
# Add the package version
- wanted += "-%s" % should
+ wanted += "-#{should}"
end
output = rug "--quiet", :install, "-y", wanted
unless self.query
raise Puppet::ExecutionFailure.new(
- "Could not find package %s" % self.name
+ "Could not find package #{self.name}"
)
end
end
diff --git a/lib/puppet/provider/package/up2date.rb b/lib/puppet/provider/package/up2date.rb
index 1de7c6ea5..8780e7fd4 100644
--- a/lib/puppet/provider/package/up2date.rb
+++ b/lib/puppet/provider/package/up2date.rb
@@ -15,7 +15,7 @@ Puppet::Type.type(:package).provide :up2date, :parent => :rpm, :source => :rpm d
unless self.query
raise Puppet::ExecutionFailure.new(
- "Could not find package %s" % self.name
+ "Could not find package #{self.name}"
)
end
end
diff --git a/lib/puppet/provider/package/urpmi.rb b/lib/puppet/provider/package/urpmi.rb
index 05eed42d7..a7732c4a2 100644
--- a/lib/puppet/provider/package/urpmi.rb
+++ b/lib/puppet/provider/package/urpmi.rb
@@ -27,14 +27,14 @@ Puppet::Type.type(:package).provide :urpmi, :parent => :rpm, :source => :rpm do
# pass
else
# Add the package version
- wanted += "-%s" % should
+ wanted += "-#{should}"
end
output = urpmi "--auto", wanted
unless self.query
raise Puppet::Error.new(
- "Could not find package %s" % self.name
+ "Could not find package #{self.name}"
)
end
end
diff --git a/lib/puppet/provider/package/yum.rb b/lib/puppet/provider/package/yum.rb
index 32ab2c124..4ff365de7 100755
--- a/lib/puppet/provider/package/yum.rb
+++ b/lib/puppet/provider/package/yum.rb
@@ -62,14 +62,14 @@ Puppet::Type.type(:package).provide :yum, :parent => :rpm, :source => :rpm do
should = nil
else
# Add the package version
- wanted += "-%s" % should
+ wanted += "-#{should}"
end
output = yum "-d", "0", "-e", "0", "-y", :install, wanted
is = self.query
unless is
- raise Puppet::Error, "Could not find package %s" % self.name
+ raise Puppet::Error, "Could not find package #{self.name}"
end
# FIXME: Should we raise an exception even if should == :latest
diff --git a/lib/puppet/provider/package/zypper.rb b/lib/puppet/provider/package/zypper.rb
index 03a504fe5..9f7386b20 100644
--- a/lib/puppet/provider/package/zypper.rb
+++ b/lib/puppet/provider/package/zypper.rb
@@ -20,13 +20,13 @@ Puppet::Type.type(:package).provide :zypper, :parent => :rpm do
# pass
else
# Add the package version
- wanted = "%s-%s" % [wanted, should]
+ wanted = "#{wanted}-#{should}"
end
output = zypper "--quiet", :install, "-l", "-y", wanted
unless self.query
raise Puppet::ExecutionFailure.new(
- "Could not find package %s" % self.name
+ "Could not find package #{self.name}"
)
end
end
diff --git a/lib/puppet/provider/parsedfile.rb b/lib/puppet/provider/parsedfile.rb
index 47e4fcd69..e4d1e95f3 100755
--- a/lib/puppet/provider/parsedfile.rb
+++ b/lib/puppet/provider/parsedfile.rb
@@ -48,7 +48,7 @@ class Puppet::Provider::ParsedFile < Puppet::Provider
elsif klass = Puppet::Util::FileType.filetype(type)
@filetype = klass
else
- raise ArgumentError, "Invalid filetype %s" % type
+ raise ArgumentError, "Invalid filetype #{type}"
end
end
@@ -70,7 +70,7 @@ class Puppet::Provider::ParsedFile < Puppet::Provider
flushed = []
@modified.sort { |a,b| a.to_s <=> b.to_s }.uniq.each do |target|
- Puppet.debug "Flushing %s provider target %s" % [@resource_type.name, target]
+ Puppet.debug "Flushing #{@resource_type.name} provider target #{target}"
flush_target(target)
flushed << target
end
@@ -234,7 +234,7 @@ class Puppet::Provider::ParsedFile < Puppet::Provider
end
unless target_records
- raise Puppet::DevError, "Prefetching %s for provider %s returned nil" % [target, self.name]
+ raise Puppet::DevError, "Prefetching #{target} for provider #{self.name} returned nil"
end
target_records
diff --git a/lib/puppet/provider/port/parsed.rb b/lib/puppet/provider/port/parsed.rb
index 624c267b9..5c973b6af 100755
--- a/lib/puppet/provider/port/parsed.rb
+++ b/lib/puppet/provider/port/parsed.rb
@@ -27,7 +27,7 @@ require 'puppet/provider/parsedfile'
# record_line :parsed, :fields => %w{name port protocols alias description},
# :optional => %w{alias description} do |line|
# if line =~ /\/ddp/
-# raise "missed ddp in %s" % line
+# raise "missed ddp in #{line}"
# end
# # The record might contain multiple port lines separated by \n.
# hashes = line.split("\n").collect { |l| parse_port(l) }
@@ -113,7 +113,7 @@ require 'puppet/provider/parsedfile'
# # line.inspect
# next
# end
-# Puppet.notice "Ignoring unparseable line '%s' in %s" % [line, self.target]
+# Puppet.notice "Ignoring unparseable line '#{line}' in #{self.target}"
# end
#
# if hash.empty?
@@ -157,14 +157,14 @@ require 'puppet/provider/parsedfile'
#
# # Strangely, most sites seem to use tabs as separators.
# hash[:protocols].collect { |proto|
-# str = "%s\t\t%s/%s" % [hash[:name], hash[:number], proto]
+# str = "#{hash[:name]}\t\t#{hash[:number]}/#{proto}"
#
# if value = hash[:alias] and value != :absent
-# str += "\t\t%s" % value.join(" ")
+# str += "\t\t#{value.join(" ")}"
# end
#
# if value = hash[:description] and value != :absent
-# str += "\t# %s" % value
+# str += "\t# #{value}"
# end
# str
# }.join("\n")
diff --git a/lib/puppet/provider/selboolean/getsetsebool.rb b/lib/puppet/provider/selboolean/getsetsebool.rb
index c993c3748..940ce3b70 100644
--- a/lib/puppet/provider/selboolean/getsetsebool.rb
+++ b/lib/puppet/provider/selboolean/getsetsebool.rb
@@ -15,7 +15,7 @@ Puppet::Type.type(:selboolean).provide(:getsetsebool) do
return :on
else
status.chomp!
- raise Puppet::Error, "Invalid response '%s' returned from getsebool" % [status]
+ raise Puppet::Error, "Invalid response '#{status}' returned from getsebool"
end
end
diff --git a/lib/puppet/provider/selmodule/semodule.rb b/lib/puppet/provider/selmodule/semodule.rb
index c75acfa5e..2f2416b4b 100644
--- a/lib/puppet/provider/selmodule/semodule.rb
+++ b/lib/puppet/provider/selmodule/semodule.rb
@@ -7,7 +7,7 @@ Puppet::Type.type(:selmodule).provide(:semodule) do
begin
execoutput("#{command(:semodule)} --install #{selmod_name_to_filename}")
rescue Puppet::ExecutionFailure => detail
- raise Puppet::Error, "Could not load policy module: %s" % [detail];
+ raise Puppet::Error, "Could not load policy module: #{detail}";
end
return :true
end
@@ -16,7 +16,7 @@ Puppet::Type.type(:selmodule).provide(:semodule) do
begin
execoutput("#{command(:semodule)} --remove #{@resource[:name]}")
rescue Puppet::ExecutionFailure => detail
- raise Puppet::Error, "Could not remove policy module: %s" % [detail];
+ raise Puppet::Error, "Could not remove policy module: #{detail}";
end
end
@@ -50,7 +50,7 @@ Puppet::Type.type(:selmodule).provide(:semodule) do
begin
execoutput("#{command(:semodule)} --upgrade #{selmod_name_to_filename}")
rescue Puppet::ExecutionFailure => detail
- raise Puppet::Error, "Could not upgrade policy module: %s" % [detail];
+ raise Puppet::Error, "Could not upgrade policy module: #{detail}";
end
end
@@ -136,7 +136,7 @@ Puppet::Type.type(:selmodule).provide(:semodule) do
end
end
rescue Puppet::ExecutionFailure
- raise Puppet::ExecutionFailure, "Could not list policy modules: %s" % [lines.join(' ').chomp!]
+ raise Puppet::ExecutionFailure, "Could not list policy modules: #{lines.join(' ').chomp!}"
end
return nil
end
diff --git a/lib/puppet/provider/service/base.rb b/lib/puppet/provider/service/base.rb
index 2e9ac778a..7428f266c 100755
--- a/lib/puppet/provider/service/base.rb
+++ b/lib/puppet/provider/service/base.rb
@@ -70,7 +70,7 @@ Puppet::Type.type(:service).provide :base do
return :stopped
end
elsif pid = self.getpid
- self.debug "PID is %s" % pid
+ self.debug "PID is #{pid}"
return :running
else
return :stopped
@@ -108,13 +108,13 @@ Puppet::Type.type(:service).provide :base do
else
pid = getpid
unless pid
- self.info "%s is not running" % self.name
+ self.info "#{self.name} is not running"
return false
end
begin
output = kill pid
rescue Puppet::ExecutionFailure => detail
- @resource.fail "Could not kill %s, PID %s: %s" % [self.name, pid, output]
+ @resource.fail "Could not kill #{self.name}, PID #{pid}: #{output}"
end
return true
end
@@ -130,7 +130,7 @@ Puppet::Type.type(:service).provide :base do
# #565: Services generally produce no output, so squelch them.
execute(command, :failonfail => fof, :squelch => true)
rescue Puppet::ExecutionFailure => detail
- @resource.fail "Could not %s %s: %s" % [type, @resource.ref, detail]
+ @resource.fail "Could not #{type} #{@resource.ref}: #{detail}"
end
return nil
end
diff --git a/lib/puppet/provider/service/daemontools.rb b/lib/puppet/provider/service/daemontools.rb
index cb3ac51a1..e8409860a 100644
--- a/lib/puppet/provider/service/daemontools.rb
+++ b/lib/puppet/provider/service/daemontools.rb
@@ -66,7 +66,7 @@ Puppet::Type.type(:service).provide :daemontools, :parent => :base do
def self.instances
path = self.defpath
unless FileTest.directory?(path)
- Puppet.notice "Service path %s does not exist" % path
+ Puppet.notice "Service path #{path} does not exist"
next
end
@@ -119,7 +119,7 @@ Puppet::Type.type(:service).provide :daemontools, :parent => :base do
return :running
end
rescue Puppet::ExecutionFailure => detail
- raise Puppet::Error.new( "Could not get status for service %s: %s" % [ resource.ref, detail] )
+ raise Puppet::Error.new( "Could not get status for service #{resource.ref}: #{detail}" )
end
return :stopped
end
@@ -127,13 +127,13 @@ Puppet::Type.type(:service).provide :daemontools, :parent => :base do
def setupservice
begin
if resource[:manifest]
- Puppet.notice "Configuring %s" % resource[:name]
+ Puppet.notice "Configuring #{resource[:name]}"
command = [ resource[:manifest], resource[:name] ]
#texecute("setupservice", command)
rv = system("#{command}")
end
rescue Puppet::ExecutionFailure => detail
- raise Puppet::Error.new( "Cannot config %s to enable it: %s" % [ self.service, detail ] )
+ raise Puppet::Error.new( "Cannot config #{self.service} to enable it: #{detail}" )
end
end
@@ -151,34 +151,34 @@ Puppet::Type.type(:service).provide :daemontools, :parent => :base do
def enable
begin
if ! FileTest.directory?(self.daemon)
- Puppet.notice "No daemon dir, calling setupservice for %s" % resource[:name]
+ Puppet.notice "No daemon dir, calling setupservice for #{resource[:name]}"
self.setupservice
end
if self.daemon
if ! FileTest.symlink?(self.service)
- Puppet.notice "Enabling %s: linking %s -> %s" % [ self.service, self.daemon, self.service ]
+ Puppet.notice "Enabling #{self.service}: linking #{self.daemon} -> #{self.service}"
File.symlink(self.daemon, self.service)
end
end
rescue Puppet::ExecutionFailure => detail
- raise Puppet::Error.new( "No daemon directory found for %s" % self.service )
+ raise Puppet::Error.new( "No daemon directory found for #{self.service}")
end
end
def disable
begin
if ! FileTest.directory?(self.daemon)
- Puppet.notice "No daemon dir, calling setupservice for %s" % resource[:name]
+ Puppet.notice "No daemon dir, calling setupservice for #{resource[:name]}"
self.setupservice
end
if self.daemon
if FileTest.symlink?(self.service)
- Puppet.notice "Disabling %s: removing link %s -> %s" % [ self.service, self.daemon, self.service ]
+ Puppet.notice "Disabling #{self.service}: removing link #{self.daemon} -> #{self.service}"
File.unlink(self.service)
end
end
rescue Puppet::ExecutionFailure => detail
- raise Puppet::Error.new( "No daemon directory found for %s" % self.service )
+ raise Puppet::Error.new( "No daemon directory found for #{self.service}")
end
self.stop
end
diff --git a/lib/puppet/provider/service/gentoo.rb b/lib/puppet/provider/service/gentoo.rb
index 0327eb297..a3d477751 100644
--- a/lib/puppet/provider/service/gentoo.rb
+++ b/lib/puppet/provider/service/gentoo.rb
@@ -21,7 +21,7 @@ Puppet::Type.type(:service).provide :gentoo, :parent => :init do
begin
output = update :del, @resource[:name], :default
rescue Puppet::ExecutionFailure
- raise Puppet::Error, "Could not disable %s: %s" % [self.name, output]
+ raise Puppet::Error, "Could not disable #{self.name}: #{output}"
end
end
@@ -48,7 +48,7 @@ Puppet::Type.type(:service).provide :gentoo, :parent => :init do
begin
output = update :add, @resource[:name], :default
rescue Puppet::ExecutionFailure
- raise Puppet::Error, "Could not enable %s: %s" % [self.name, output]
+ raise Puppet::Error, "Could not enable #{self.name}: #{output}"
end
end
end
diff --git a/lib/puppet/provider/service/init.rb b/lib/puppet/provider/service/init.rb
index 5804732ed..d5dc21477 100755
--- a/lib/puppet/provider/service/init.rb
+++ b/lib/puppet/provider/service/init.rb
@@ -36,7 +36,7 @@ Puppet::Type.type(:service).provide :init, :parent => :base do
instances = []
defpath.each do |path|
unless FileTest.directory?(path)
- Puppet.debug "Service path %s does not exist" % path
+ Puppet.debug "Service path #{path} does not exist"
next
end
@@ -63,7 +63,7 @@ Puppet::Type.type(:service).provide :init, :parent => :base do
when true, "true"; @parameters[:hasstatus] = true
when false, "false"; @parameters[:hasstatus] = false
else
- raise Puppet::Error, "Invalid 'hasstatus' value %s" % value.inspect
+ raise Puppet::Error, "Invalid 'hasstatus' value #{value.inspect}"
end
end
@@ -94,7 +94,7 @@ Puppet::Type.type(:service).provide :init, :parent => :base do
stat = File.stat(fqname)
rescue
# should probably rescue specific errors...
- self.debug("Could not find %s in %s" % [name,path])
+ self.debug("Could not find #{name} in #{path}")
next
end
@@ -108,14 +108,14 @@ Puppet::Type.type(:service).provide :init, :parent => :base do
stat = File.stat(fqname_sh)
rescue
# should probably rescue specific errors...
- self.debug("Could not find %s.sh in %s" % [name,path])
+ self.debug("Could not find #{name}.sh in #{path}")
next
end
# if we've gotten this far, we found a valid script
return fqname_sh
}
- raise Puppet::Error, "Could not find init script for '%s'" % name
+ raise Puppet::Error, "Could not find init script for '#{name}'"
end
# The start command is just the init scriptwith 'start'.
diff --git a/lib/puppet/provider/service/launchd.rb b/lib/puppet/provider/service/launchd.rb
index c65e1cc1a..635c30b49 100644
--- a/lib/puppet/provider/service/launchd.rb
+++ b/lib/puppet/provider/service/launchd.rb
@@ -111,12 +111,12 @@ Puppet::Type.type(:service).provide :launchd, :parent => :base do
product_version_major = product_version.scan(/(\d+)\.(\d+)./).join(".")
end
if %w{10.0 10.1 10.2 10.3}.include?(product_version_major)
- fail("%s is not supported by the launchd provider" % product_version_major)
+ fail("#{product_version_major} is not supported by the launchd provider")
end
@macosx_version_major = product_version_major
return @macosx_version_major
rescue Puppet::ExecutionFailure => detail
- fail("Could not determine OS X version: %s" % detail)
+ fail("Could not determine OS X version: #{detail}")
end
end
@@ -171,7 +171,7 @@ Puppet::Type.type(:service).provide :launchd, :parent => :base do
begin
execute(cmds)
rescue Puppet::ExecutionFailure
- raise Puppet::Error.new("Unable to start service: %s at path: %s" % [resource[:name], job_path])
+ raise Puppet::Error.new("Unable to start service: #{resource[:name]} at path: #{job_path}")
end
# As load -w clears the Disabled flag, we need to add it in after
if did_enable_job and resource[:enable] == :false
@@ -193,7 +193,7 @@ Puppet::Type.type(:service).provide :launchd, :parent => :base do
begin
execute(cmds)
rescue Puppet::ExecutionFailure
- raise Puppet::Error.new("Unable to stop service: %s at path: %s" % [resource[:name], job_path])
+ raise Puppet::Error.new("Unable to stop service: #{resource[:name]} at path: #{job_path}")
end
# As unload -w sets the Disabled flag, we need to add it in after
if did_disable_job and resource[:enable] == :true
diff --git a/lib/puppet/provider/service/redhat.rb b/lib/puppet/provider/service/redhat.rb
index f3d5caee0..c49df3142 100755
--- a/lib/puppet/provider/service/redhat.rb
+++ b/lib/puppet/provider/service/redhat.rb
@@ -25,7 +25,7 @@ Puppet::Type.type(:service).provide :redhat, :parent => :init, :source => :init
begin
output = chkconfig(@resource[:name], :off)
rescue Puppet::ExecutionFailure
- raise Puppet::Error, "Could not disable %s: %s" % [self.name, output]
+ raise Puppet::Error, "Could not disable #{self.name}: #{output}"
end
end
@@ -51,12 +51,12 @@ Puppet::Type.type(:service).provide :redhat, :parent => :init, :source => :init
begin
output = chkconfig(@resource[:name], :on)
rescue Puppet::ExecutionFailure => detail
- raise Puppet::Error, "Could not enable %s: %s" % [self.name, detail]
+ raise Puppet::Error, "Could not enable #{self.name}: #{detail}"
end
end
def initscript
- raise Puppet::Error, "Do not directly call the init script for '%s'; use 'service' instead" % @resource[:name]
+ raise Puppet::Error, "Do not directly call the init script for '#{@resource[:name]}'; use 'service' instead"
end
# use hasstatus=>true when its set for the provider.
diff --git a/lib/puppet/provider/service/runit.rb b/lib/puppet/provider/service/runit.rb
index 265111469..3b49d14ef 100644
--- a/lib/puppet/provider/service/runit.rb
+++ b/lib/puppet/provider/service/runit.rb
@@ -72,7 +72,7 @@ Puppet::Type.type(:service).provide :runit, :parent => :daemontools do
return :running if output =~ /^run: /
rescue Puppet::ExecutionFailure => detail
unless detail.message =~ /(warning: |runsv not running$)/
- raise Puppet::Error.new( "Could not get status for service %s: %s" % [ resource.ref, detail] )
+ raise Puppet::Error.new( "Could not get status for service #{resource.ref}: #{detail}" )
end
end
return :stopped
diff --git a/lib/puppet/provider/service/smf.rb b/lib/puppet/provider/service/smf.rb
index 72f34ef37..0407c8479 100755
--- a/lib/puppet/provider/service/smf.rb
+++ b/lib/puppet/provider/service/smf.rb
@@ -23,12 +23,12 @@ Puppet::Type.type(:service).provide :smf, :parent => :base do
if resource[:manifest]
[command(:svcs), "-l", @resource[:name]]
if $CHILD_STATUS.exitstatus == 1
- Puppet.notice "Importing %s for %s" % [ @resource[:manifest], @resource[:name] ]
+ Puppet.notice "Importing #{@resource[:manifest]} for #{@resource[:name]}"
svccfg :import, resource[:manifest]
end
end
rescue Puppet::ExecutionFailure => detail
- raise Puppet::Error.new( "Cannot config %s to enable it: %s" % [ self.service, detail ] )
+ raise Puppet::Error.new( "Cannot config #{self.service} to enable it: #{detail}" )
end
end
@@ -75,16 +75,16 @@ Puppet::Type.type(:service).provide :smf, :parent => :base do
states = svcs("-H", "-o", "state,nstate", @resource[:name]).chomp.split
state = states[1] == "-" ? states[0] : states[1]
rescue Puppet::ExecutionFailure
- info "Could not get status on service %s" % self.name
+ info "Could not get status on service #{self.name}"
return :stopped
end
case state
when "online"
- #self.warning "matched running %s" % line.inspect
+ #self.warning "matched running #{line.inspect}"
return :running
when "offline", "disabled", "uninitialized"
- #self.warning "matched stopped %s" % line.inspect
+ #self.warning "matched stopped #{line.inspect}"
return :stopped
when "maintenance"
return :maintenance
@@ -93,7 +93,7 @@ Puppet::Type.type(:service).provide :smf, :parent => :base do
"Cannot manage legacy services through SMF"
else
raise Puppet::Error,
- "Unmanageable state '%s' on service %s" % [state, self.name]
+ "Unmanageable state '#{state}' on service #{self.name}"
end
end
diff --git a/lib/puppet/provider/service/src.rb b/lib/puppet/provider/service/src.rb
index fe178ab4f..135edcb65 100755
--- a/lib/puppet/provider/service/src.rb
+++ b/lib/puppet/provider/service/src.rb
@@ -55,12 +55,12 @@ Puppet::Type.type(:service).provide :src, :parent => :base do
end
return :true
rescue Puppet::ExecutionFailure => detail
- raise Puppet::Error.new("Unable to restart service %s, error was: %s" % [ @resource[:name], detail ] )
+ raise Puppet::Error.new("Unable to restart service #{@resource[:name]}, error was: #{detail}" )
end
end
self.fail("No such service found")
rescue Puppet::ExecutionFailure => detail
- raise Puppet::Error.new("Cannot get status of %s, error was: %s" % [ @resource[:name], detail ] )
+ raise Puppet::Error.new("Cannot get status of #{@resource[:name]}, error was: #{detail}" )
end
end
@@ -83,7 +83,7 @@ Puppet::Type.type(:service).provide :src, :parent => :base do
end
self.fail("No such service found")
rescue Puppet::ExecutionFailure => detail
- raise Puppet::Error.new("Cannot get status of %s, error was: %s" % [ @resource[:name], detail ] )
+ raise Puppet::Error.new("Cannot get status of #{@resource[:name]}, error was: #{detail}" )
end
end
diff --git a/lib/puppet/provider/user/directoryservice.rb b/lib/puppet/provider/user/directoryservice.rb
index ffb7a65de..d3cb4f244 100644
--- a/lib/puppet/provider/user/directoryservice.rb
+++ b/lib/puppet/provider/user/directoryservice.rb
@@ -59,7 +59,7 @@ Puppet::Type.type(:user).provide :directoryservice, :parent => Puppet::Provider:
# when String
# groups = groups.split(/\s*,\s*/)
# else
- # raise Puppet::DevError, "got invalid groups value %s of type %s" % [groups.class, groups]
+ # raise Puppet::DevError, "got invalid groups value #{groups.class} of type #{groups}"
# end
# # Get just the groups we need to modify
# diff = groups - (@is || [])
diff --git a/lib/puppet/provider/user/ldap.rb b/lib/puppet/provider/user/ldap.rb
index 7c38880cb..888d3bfd7 100644
--- a/lib/puppet/provider/user/ldap.rb
+++ b/lib/puppet/provider/user/ldap.rb
@@ -61,7 +61,7 @@ Puppet::Type.type(:user).provide :ldap, :parent => Puppet::Provider::Ldap do
# We want to cache the current result, so we know if we
# have to remove old values.
unless @property_hash[:groups]
- unless result = group_manager.search("memberUid=%s" % name)
+ unless result = group_manager.search("memberUid=#{name}")
return @property_hash[:groups] = :absent
end
@@ -93,7 +93,7 @@ Puppet::Type.type(:user).provide :ldap, :parent => Puppet::Provider::Ldap do
end
modes.each do |group, form|
- self.fail "Could not find ldap group %s" % group unless ldap_group = group_manager.find(group)
+ self.fail "Could not find ldap group #{group}" unless ldap_group = group_manager.find(group)
current = ldap_group[:members]
diff --git a/lib/puppet/provider/user/user_role_add.rb b/lib/puppet/provider/user/user_role_add.rb
index 961cb5e73..126b95e95 100644
--- a/lib/puppet/provider/user/user_role_add.rb
+++ b/lib/puppet/provider/user/user_role_add.rb
@@ -54,7 +54,7 @@ Puppet::Type.type(:user).provide :user_role_add, :parent => :useradd, :source =>
def command(cmd)
if is_role? or (!exists? and @resource[:ensure] == :role)
- cmd = ("role_" + cmd.to_s).intern
+ cmd = ("role_#{cmd}").intern
end
super(cmd)
end
@@ -67,7 +67,7 @@ Puppet::Type.type(:user).provide :user_role_add, :parent => :useradd, :source =>
begin
execute(cmd)
rescue Puppet::ExecutionFailure => detail
- raise Puppet::Error, "Could not %s %s %s: %s" % [msg, @resource.class.name, @resource.name, detail]
+ raise Puppet::Error, "Could not #{msg} #{@resource.class.name} #{@resource.name}: #{detail}"
end
end
@@ -182,7 +182,7 @@ Puppet::Type.type(:user).provide :user_role_add, :parent => :useradd, :source =>
end
File.rename("/etc/shadow_tmp", "/etc/shadow")
rescue => detail
- fail "Could not write temporary shadow file: %s" % detail
+ fail "Could not write temporary shadow file: #{detail}"
ensure
# Make sure this *always* gets deleted
File.unlink("/etc/shadow_tmp") if File.exist?("/etc/shadow_tmp")
diff --git a/lib/puppet/provider/zone/solaris.rb b/lib/puppet/provider/zone/solaris.rb
index 4d7e7473d..a5345e457 100644
--- a/lib/puppet/provider/zone/solaris.rb
+++ b/lib/puppet/provider/zone/solaris.rb
@@ -37,7 +37,7 @@ Puppet::Type.type(:zone).provide(:solaris) do
def configure
# If the thing is entirely absent, then we need to create the config.
# Is there someway to get this on one line?
- str = "create -b #{@resource[:create_args]}\nset zonepath=%s\n" % @resource[:path]
+ str = "create -b #{@resource[:create_args]}\nset zonepath=#{@resource[:path]}\n"
# Then perform all of our configuration steps. It's annoying
# that we need this much internal info on the resource.
@@ -131,10 +131,10 @@ Puppet::Type.type(:zone).provide(:solaris) do
end
current[$1.intern] = $2
else
- err "Ignoring '%s'" % line
+ err "Ignoring '#{line}'"
end
else
- debug "Ignoring zone output '%s'" % line
+ debug "Ignoring zone output '#{line}'"
end
end
@@ -144,8 +144,8 @@ Puppet::Type.type(:zone).provide(:solaris) do
# Execute a configuration string. Can't be private because it's called
# by the properties.
def setconfig(str)
- command = "#{command(:cfg)} -z %s -f -" % @resource[:name]
- debug "Executing '%s' in zone %s with '%s'" % [command, @resource[:name], str]
+ command = "#{command(:cfg)} -z #{@resource[:name]} -f -"
+ debug "Executing '#{command}' in zone #{@resource[:name]} with '#{str}'"
IO.popen(command, "w") do |pipe|
pipe.puts str
end
@@ -174,7 +174,7 @@ Puppet::Type.type(:zone).provide(:solaris) do
if Puppet[:debug]
puts detail.stacktrace
end
- raise Puppet::Error, "Could not create sysidcfg: %s" % detail
+ raise Puppet::Error, "Could not create sysidcfg: #{detail}"
end
end
end
@@ -233,9 +233,9 @@ Puppet::Type.type(:zone).provide(:solaris) do
if net = config["net"]
result[:ip] = net.collect do |params|
if params[:defrouter]
- "%s:%s:%s" % [params[:physical], params[:address], params[:defrouter]]
+ "#{params[:physical]}:#{params[:address]}:#{params[:defrouter]}"
elsif params[:address]
- "%s:%s" % [params[:physical], params[:address]]
+ "#{params[:physical]}:#{params[:address]}"
else
params[:physical]
end
@@ -249,7 +249,7 @@ Puppet::Type.type(:zone).provide(:solaris) do
begin
adm("-z", @resource[:name], *cmd)
rescue Puppet::ExecutionFailure => detail
- self.fail "Could not %s zone: %s" % [cmd[0], detail]
+ self.fail "Could not #{cmd[0]} zone: #{detail}"
end
end
@@ -260,7 +260,7 @@ Puppet::Type.type(:zone).provide(:solaris) do
begin
cfg("-z", self.name, *cmd)
rescue Puppet::ExecutionFailure => detail
- self.fail "Could not %s zone: %s" % [cmd[0], detail]
+ self.fail "Could not #{cmd[0]} zone: #{detail}"
end
end
end
diff --git a/lib/puppet/provider/zpool/solaris.rb b/lib/puppet/provider/zpool/solaris.rb
index 8fc01ba81..a54af3df8 100644
--- a/lib/puppet/provider/zpool/solaris.rb
+++ b/lib/puppet/provider/zpool/solaris.rb
@@ -108,7 +108,7 @@ Puppet::Type.type(:zpool).provide(:solaris) do
end
define_method(field.to_s + "=") do |should|
- Puppet.warning "NO CHANGES BEING MADE: zpool %s does not match, should be '%s' currently is '%s'" % [field, should, current_pool[field]]
+ Puppet.warning "NO CHANGES BEING MADE: zpool #{field} does not match, should be '#{should}' currently is '#{current_pool[field]}'"
end
end
diff --git a/lib/puppet/rails.rb b/lib/puppet/rails.rb
index be252e444..33abe8d8a 100644
--- a/lib/puppet/rails.rb
+++ b/lib/puppet/rails.rb
@@ -18,7 +18,7 @@ module Puppet::Rails
loglevel = Logger.const_get(Puppet[:rails_loglevel].upcase)
ActiveRecord::Base.logger.level = loglevel
rescue => detail
- Puppet.warning "'%s' is not a valid Rails log level; using debug" % Puppet[:rails_loglevel]
+ Puppet.warning "'#{Puppet[:rails_loglevel]}' is not a valid Rails log level; using debug"
ActiveRecord::Base.logger.level = Logger::DEBUG
end
@@ -36,7 +36,7 @@ module Puppet::Rails
if Puppet[:trace]
puts detail.backtrace
end
- raise Puppet::Error, "Could not connect to database: %s" % detail
+ raise Puppet::Error, "Could not connect to database: #{detail}"
end
end
@@ -70,7 +70,7 @@ module Puppet::Rails
connections = Puppet[:dbconnections].to_i
args[:pool] = connections if connections > 0
else
- raise ArgumentError, "Invalid db adapter %s" % adapter
+ raise ArgumentError, "Invalid db adapter #{adapter}"
end
args
end
@@ -121,7 +121,7 @@ module Puppet::Rails
if Puppet[:trace]
puts detail.backtrace
end
- raise Puppet::Error, "Could not migrate database: %s" % detail
+ raise Puppet::Error, "Could not migrate database: #{detail}"
end
end
@@ -139,7 +139,7 @@ module Puppet::Rails
if Puppet[:trace]
puts detail.backtrace
end
- raise Puppet::Error, "Could not connect to database: %s" % detail
+ raise Puppet::Error, "Could not connect to database: #{detail}"
end
ActiveRecord::Base.connection.tables.each do |t|
diff --git a/lib/puppet/rails/benchmark.rb b/lib/puppet/rails/benchmark.rb
index 1fbd011e9..72ffa7443 100644
--- a/lib/puppet/rails/benchmark.rb
+++ b/lib/puppet/rails/benchmark.rb
@@ -45,7 +45,7 @@ module Puppet::Rails::Benchmark
end
$benchmarks[:accumulated][message].each do |label, value|
- Puppet.debug(message + ("(%s)" % label) + (" in %0.2f seconds" % value))
+ Puppet.debug(message + ("(#{label})") + (" in %0.2f seconds" % value))
end
end
diff --git a/lib/puppet/rails/param_value.rb b/lib/puppet/rails/param_value.rb
index d0bb8d7d3..e4b5a668f 100644
--- a/lib/puppet/rails/param_value.rb
+++ b/lib/puppet/rails/param_value.rb
@@ -48,7 +48,7 @@ class Puppet::Rails::ParamValue < ActiveRecord::Base
# returns an array of hash containing all the parameters of a given resource
def self.find_all_params_from_resource(db_resource)
- params = db_resource.connection.select_all("SELECT v.id, v.value, v.line, v.resource_id, v.param_name_id, n.name FROM param_values v INNER JOIN param_names n ON v.param_name_id=n.id WHERE v.resource_id=%s" % db_resource.id)
+ params = db_resource.connection.select_all("SELECT v.id, v.value, v.line, v.resource_id, v.param_name_id, n.name FROM param_values v INNER JOIN param_names n ON v.param_name_id=n.id WHERE v.resource_id=#{db_resource.id}")
params.each do |val|
val['value'] = unserialize_value(val['value'])
val['line'] = val['line'] ? Integer(val['line']) : nil
@@ -59,7 +59,7 @@ class Puppet::Rails::ParamValue < ActiveRecord::Base
# returns an array of hash containing all the parameters of a given host
def self.find_all_params_from_host(db_host)
- params = db_host.connection.select_all("SELECT v.id, v.value, v.line, v.resource_id, v.param_name_id, n.name FROM param_values v INNER JOIN resources r ON v.resource_id=r.id INNER JOIN param_names n ON v.param_name_id=n.id WHERE r.host_id=%s" % db_host.id)
+ params = db_host.connection.select_all("SELECT v.id, v.value, v.line, v.resource_id, v.param_name_id, n.name FROM param_values v INNER JOIN resources r ON v.resource_id=r.id INNER JOIN param_names n ON v.param_name_id=n.id WHERE r.host_id=#{db_host.id}")
params.each do |val|
val['value'] = unserialize_value(val['value'])
val['line'] = val['line'] ? Integer(val['line']) : nil
@@ -69,6 +69,6 @@ class Puppet::Rails::ParamValue < ActiveRecord::Base
end
def to_s
- "%s => %s" % [self.name, self.value]
+ "#{self.name} => #{self.value}"
end
end
diff --git a/lib/puppet/rails/resource.rb b/lib/puppet/rails/resource.rb
index 7b37a52bf..f2c41c17e 100644
--- a/lib/puppet/rails/resource.rb
+++ b/lib/puppet/rails/resource.rb
@@ -194,7 +194,7 @@ class Puppet::Rails::Resource < ActiveRecord::Base
end
def ref(dummy_argument=:work_arround_for_ruby_GC_bug)
- "%s[%s]" % [self[:restype].split("::").collect { |s| s.capitalize }.join("::"), self.title.to_s]
+ "#{self[:restype].split("::").collect { |s| s.capitalize }.join("::")}[#{self.title}]"
end
# Returns a hash of parameter names and values, no ActiveRecord instances.
diff --git a/lib/puppet/rails/resource_tag.rb b/lib/puppet/rails/resource_tag.rb
index f094eabb8..0bbac11d3 100644
--- a/lib/puppet/rails/resource_tag.rb
+++ b/lib/puppet/rails/resource_tag.rb
@@ -8,7 +8,7 @@ class Puppet::Rails::ResourceTag < ActiveRecord::Base
# returns an array of hash containing tags of resource
def self.find_all_tags_from_resource(db_resource)
- tags = db_resource.connection.select_all("SELECT t.id, t.resource_id, p.name FROM resource_tags t INNER JOIN puppet_tags p ON t.puppet_tag_id=p.id WHERE t.resource_id=%s" % db_resource.id)
+ tags = db_resource.connection.select_all("SELECT t.id, t.resource_id, p.name FROM resource_tags t INNER JOIN puppet_tags p ON t.puppet_tag_id=p.id WHERE t.resource_id=#{db_resource.id}")
tags.each do |val|
val['resource_id'] = Integer(val['resource_id'])
end
@@ -17,7 +17,7 @@ class Puppet::Rails::ResourceTag < ActiveRecord::Base
# returns an array of hash containing tags of a host
def self.find_all_tags_from_host(db_host)
- tags = db_host.connection.select_all("SELECT t.id, t.resource_id, p.name FROM resource_tags t INNER JOIN resources r ON t.resource_id=r.id INNER JOIN puppet_tags p ON t.puppet_tag_id=p.id WHERE r.host_id=%s" % db_host.id)
+ tags = db_host.connection.select_all("SELECT t.id, t.resource_id, p.name FROM resource_tags t INNER JOIN resources r ON t.resource_id=r.id INNER JOIN puppet_tags p ON t.puppet_tag_id=p.id WHERE r.host_id=#{db_host.id}")
tags.each do |val|
val['resource_id'] = Integer(val['resource_id'])
end
diff --git a/lib/puppet/reference/configuration.rb b/lib/puppet/reference/configuration.rb
index 352116cd5..2f60ecc65 100644
--- a/lib/puppet/reference/configuration.rb
+++ b/lib/puppet/reference/configuration.rb
@@ -31,9 +31,9 @@ config = Puppet::Util::Reference.newreference(:configuration, :depth => 1, :doc
end
# Leave out the section information; it was apparently confusing people.
- #str += "- **Section**: %s\n" % object.section
+ #str += "- **Section**: #{object.section}\n"
unless val == ""
- str += "- **Default**: %s\n" % val
+ str += "- **Default**: #{val}\n"
end
str += "\n"
end
diff --git a/lib/puppet/reference/metaparameter.rb b/lib/puppet/reference/metaparameter.rb
index 8e0a89ac6..9368de186 100644
--- a/lib/puppet/reference/metaparameter.rb
+++ b/lib/puppet/reference/metaparameter.rb
@@ -29,7 +29,7 @@ metaparameter = Puppet::Util::Reference.newreference :metaparameter, :doc => "Al
a.to_s <=> b.to_s
}.each { |param|
str += paramwrap(param.to_s, scrub(Puppet::Type.metaparamdoc(param)), :level => 4)
- #puts "<dt>" + param.to_s + "</dt>"
+ #puts "<dt>#{param}</dt>"
#puts tab(1) + Puppet::Type.metaparamdoc(param).scrub.indent($tab)gsub(/\n\s*/,' ')
#puts "<dd>"
#puts indent(scrub(Puppet::Type.metaparamdoc(param)), $tab)
@@ -40,7 +40,7 @@ metaparameter = Puppet::Util::Reference.newreference :metaparameter, :doc => "Al
}
rescue => detail
puts detail.backtrace
- puts "incorrect metaparams: %s" % detail
+ puts "incorrect metaparams: #{detail}"
exit(1)
end
diff --git a/lib/puppet/reference/providers.rb b/lib/puppet/reference/providers.rb
index 33d85061e..cc47876d6 100644
--- a/lib/puppet/reference/providers.rb
+++ b/lib/puppet/reference/providers.rb
@@ -53,31 +53,31 @@ providers = Puppet::Util::Reference.newreference :providers, :title => "Provider
suit = true
functional = true
else
- data << "[%s]_" % [count] # A pointer to the appropriate footnote
+ data << "[#{count}]_" # A pointer to the appropriate footnote
suit = false
end
# Add a footnote with the details about why this provider is unsuitable, if that's the case
unless suit
- details = ".. [%s]\n" % count
+ details = ".. [#{count}]\n"
missing.each do |test, values|
case test
when :exists
- details += " - Missing files %s\n" % values.join(", ")
+ details += " - Missing files #{values.join(", ")}\n"
when :variable
values.each do |name, facts|
if Puppet.settings.valid?(name)
- details += " - Setting %s (currently %s) not in list %s\n" % [name, Puppet.settings.value(name).inspect, facts.join(", ")]
+ details += " - Setting #{name} (currently #{Puppet.settings.value(name).inspect}) not in list #{facts.join(", ")}\n"
else
- details += " - Fact %s (currently %s) not in list %s\n" % [name, Facter.value(name).inspect, facts.join(", ")]
+ details += " - Fact #{name} (currently #{Facter.value(name).inspect}) not in list #{facts.join(", ")}\n"
end
end
when :true
- details += " - Got %s true tests that should have been false\n" % values
+ details += " - Got #{values} true tests that should have been false\n"
when :false
- details += " - Got %s false tests that should have been true\n" % values
+ details += " - Got #{values} false tests that should have been true\n"
when :feature
- details += " - Missing features %s\n" % values.collect { |f| f.to_s }.join(",")
+ details += " - Missing features #{values.collect { |f| f.to_s }.join(",")}\n"
end
end
notes << details
@@ -97,7 +97,7 @@ providers = Puppet::Util::Reference.newreference :providers, :title => "Provider
ret += h(type.name.to_s + "_", 2)
- ret += ".. _%s: %s\n\n" % [type.name, "http://reductivelabs.com/trac/puppet/wiki/TypeReference#%s" % type.name]
+ ret += ".. _#{type.name}: #{"http://reductivelabs.com/trac/puppet/wiki/TypeReference##{type.name}"}\n\n"
ret += option("Default provider", default)
ret += doctable(headers, table_data)
diff --git a/lib/puppet/reference/type.rb b/lib/puppet/reference/type.rb
index c18681c1f..6bd8be835 100644
--- a/lib/puppet/reference/type.rb
+++ b/lib/puppet/reference/type.rb
@@ -79,12 +79,12 @@ type = Puppet::Util::Reference.newreference :type, :doc => "All Puppet resource
property = type.propertybyname(sname)
unless property
- raise "Could not retrieve property %s on type %s" % [sname, type.name]
+ raise "Could not retrieve property #{sname} on type #{type.name}"
end
doc = nil
unless doc = property.doc
- $stderr.puts "No docs for %s[%s]" % [type, sname]
+ $stderr.puts "No docs for #{type}[#{sname}]"
next
end
doc = doc.dup
diff --git a/lib/puppet/relationship.rb b/lib/puppet/relationship.rb
index 95f347539..ea91d0e69 100644
--- a/lib/puppet/relationship.rb
+++ b/lib/puppet/relationship.rb
@@ -70,7 +70,7 @@ class Puppet::Relationship
end
def ref
- "%s => %s" % [source, target]
+ "#{source} => #{target}"
end
def to_pson_data_hash
diff --git a/lib/puppet/reports.rb b/lib/puppet/reports.rb
index df992d46c..8407d67de 100755
--- a/lib/puppet/reports.rb
+++ b/lib/puppet/reports.rb
@@ -35,7 +35,7 @@ class Puppet::Reports
instance_loader(:report).loadall
loaded_instances(:report).sort { |a,b| a.to_s <=> b.to_s }.each do |name|
mod = self.report(name)
- docs += "%s\n%s\n" % [name, "-" * name.to_s.length]
+ docs += "#{name}\n#{"-" * name.to_s.length}\n"
docs += Puppet::Util::Docs.scrub(mod.doc) + "\n\n"
end
diff --git a/lib/puppet/reports/log.rb b/lib/puppet/reports/log.rb
index d99333434..827572c2c 100644
--- a/lib/puppet/reports/log.rb
+++ b/lib/puppet/reports/log.rb
@@ -6,7 +6,7 @@ Puppet::Reports.register_report(:log) do
def process
self.logs.each do |log|
- log.source = "//" + self.host + "/" + log.source
+ log.source = "//#{self.host}/#{log.source}"
Puppet::Util::Log.newmessage(log)
end
end
diff --git a/lib/puppet/reports/rrdgraph.rb b/lib/puppet/reports/rrdgraph.rb
index 508b1d28b..4e618d5ee 100644
--- a/lib/puppet/reports/rrdgraph.rb
+++ b/lib/puppet/reports/rrdgraph.rb
@@ -29,9 +29,9 @@ Puppet::Reports.register_report(:rrdgraph) do
end
def htmlfile(type, graphs, field)
- file = File.join(hostdir, "%s.html" % type)
+ file = File.join(hostdir, "#{type}.html")
File.open(file, "w") do |of|
- of.puts "<html><head><title>%s graphs for %s</title></head><body>" % [type.capitalize, host]
+ of.puts "<html><head><title>#{type.capitalize} graphs for #{host}</title></head><body>"
graphs.each do |graph|
if field == :first
@@ -39,7 +39,7 @@ Puppet::Reports.register_report(:rrdgraph) do
else
name = graph.sub(/\w+-/, '').sub(".png", '').capitalize
end
- of.puts "<img src=%s><br>" % graph
+ of.puts "<img src=#{graph}><br>"
end
of.puts "</body></html>"
end
@@ -66,7 +66,7 @@ Puppet::Reports.register_report(:rrdgraph) do
# Make the period html files
periodorder.each do |period|
unless ary = periods[period]
- raise Puppet::Error, "Could not find graphs for %s" % period
+ raise Puppet::Error, "Could not find graphs for #{period}"
end
files << htmlfile(period, ary, :first)
end
@@ -75,10 +75,10 @@ Puppet::Reports.register_report(:rrdgraph) do
types.sort { |a,b| a[0] <=> b[0] }.each do |type, ary|
newary = []
periodorder.each do |period|
- if graph = ary.find { |g| g.include?("-%s.png" % period) }
+ if graph = ary.find { |g| g.include?("-#{period}.png") }
newary << graph
else
- raise "Could not find %s-%s graph" % [type, period]
+ raise "Could not find #{type}-#{period} graph"
end
end
@@ -86,9 +86,9 @@ Puppet::Reports.register_report(:rrdgraph) do
end
File.open(File.join(hostdir, "index.html"), "w") do |of|
- of.puts "<html><head><title>Report graphs for %s</title></head><body>" % host
+ of.puts "<html><head><title>Report graphs for #{host}</title></head><body>"
files.each do |file|
- of.puts "<a href='%s'>%s</a><br/>" % [File.basename(file), File.basename(file).sub(".html",'').capitalize]
+ of.puts "<a href='#{File.basename(file)}'>#{File.basename(file).sub(".html",'').capitalize}</a><br/>"
end
of.puts "</body></html>"
end
diff --git a/lib/puppet/reports/store.rb b/lib/puppet/reports/store.rb
index 8317ee243..547b45a33 100644
--- a/lib/puppet/reports/store.rb
+++ b/lib/puppet/reports/store.rb
@@ -15,7 +15,7 @@ Puppet::Reports.register_report(:store) do
"reportclient-#{client}".to_sym,
"client-#{client}-dir" => { :default => dir,
:mode => 0750,
- :desc => "Client dir for %s" % client,
+ :desc => "Client dir for #{client}",
:owner => 'service',
:group => 'service'
},
@@ -54,7 +54,7 @@ Puppet::Reports.register_report(:store) do
if Puppet[:trace]
puts detail.backtrace
end
- Puppet.warning "Could not write report for %s at %s: %s" % [client, file, detail]
+ Puppet.warning "Could not write report for #{client} at #{file}: #{detail}"
end
# Only testing cares about the return value
diff --git a/lib/puppet/reports/tagmail.rb b/lib/puppet/reports/tagmail.rb
index 01ff1b033..270cadb91 100644
--- a/lib/puppet/reports/tagmail.rb
+++ b/lib/puppet/reports/tagmail.rb
@@ -59,7 +59,7 @@ Puppet::Reports.register_report(:tagmail) do
end
if messages.empty?
- Puppet.info "No messages to report to %s" % emails.join(",")
+ Puppet.info "No messages to report to #{emails.join(",")}"
next
else
matching_logs << [emails, messages.collect { |m| m.to_report }.join("\n")]
@@ -88,13 +88,13 @@ Puppet::Reports.register_report(:tagmail) do
neg = []
taglist.sub(/\s+$/,'').split(/\s*,\s*/).each do |tag|
unless tag =~ /^!?[-\w]+$/
- raise ArgumentError, "Invalid tag %s" % tag.inspect
+ raise ArgumentError, "Invalid tag #{tag.inspect}"
end
case tag
when /^\w+/; pos << tag
when /^!\w+/; neg << tag.sub("!", '')
else
- raise Puppet::Error, "Invalid tag '%s'" % tag
+ raise Puppet::Error, "Invalid tag '#{tag}'"
end
end
@@ -108,7 +108,7 @@ Puppet::Reports.register_report(:tagmail) do
# Process the report. This just calls the other associated messages.
def process
unless FileTest.exists?(Puppet[:tagmap])
- Puppet.notice "Cannot send tagmail report; no tagmap file %s" % Puppet[:tagmap]
+ Puppet.notice "Cannot send tagmail report; no tagmap file #{Puppet[:tagmap]}"
return
end
@@ -129,9 +129,9 @@ Puppet::Reports.register_report(:tagmail) do
reports.each do |emails, messages|
smtp.open_message_stream(Puppet[:reportfrom], *emails) do |p|
p.puts "From: #{Puppet[:reportfrom]}"
- p.puts "Subject: Puppet Report for %s" % self.host
+ p.puts "Subject: Puppet Report for #{self.host}"
p.puts "To: " + emails.join(", ")
- p.puts "Date: " + Time.now.rfc2822
+ p.puts "Date: #{Time.now.rfc2822}"
p.puts
p.puts messages
end
@@ -142,7 +142,7 @@ Puppet::Reports.register_report(:tagmail) do
puts detail.backtrace
end
raise Puppet::Error,
- "Could not send report emails through smtp: %s" % detail
+ "Could not send report emails through smtp: #{detail}"
end
elsif Puppet[:sendmail] != ""
begin
@@ -150,7 +150,7 @@ Puppet::Reports.register_report(:tagmail) do
# We need to open a separate process for every set of email addresses
IO.popen(Puppet[:sendmail] + " " + emails.join(" "), "w") do |p|
p.puts "From: #{Puppet[:reportfrom]}"
- p.puts "Subject: Puppet Report for %s" % self.host
+ p.puts "Subject: Puppet Report for #{self.host}"
p.puts "To: " + emails.join(", ")
p.puts messages
@@ -161,7 +161,7 @@ Puppet::Reports.register_report(:tagmail) do
puts detail.backtrace
end
raise Puppet::Error,
- "Could not send report emails via sendmail: %s" % detail
+ "Could not send report emails via sendmail: #{detail}"
end
else
raise Puppet::Error, "SMTP server is unset and could not find sendmail"
diff --git a/lib/puppet/resource/catalog.rb b/lib/puppet/resource/catalog.rb
index 2c5c94920..98a380e87 100644
--- a/lib/puppet/resource/catalog.rb
+++ b/lib/puppet/resource/catalog.rb
@@ -71,7 +71,7 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
def add_resource(*resources)
resources.each do |resource|
unless resource.respond_to?(:ref)
- raise ArgumentError, "Can only add objects that respond to :ref, not instances of %s" % resource.class
+ raise ArgumentError, "Can only add objects that respond to :ref, not instances of #{resource.class}"
end
end.each { |resource| fail_on_duplicate_type_and_title(resource) }.each do |resource|
title_key = title_key_for_ref(resource.ref)
@@ -105,7 +105,7 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
newref = [class_name, key]
if key.is_a? String
- ref_string = "%s[%s]" % [class_name, key]
+ ref_string = "#{class_name}[#{key}]"
return if ref_string == resource.ref
end
@@ -115,7 +115,7 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
# isn't sufficient.
if existing = @resource_table[newref]
return if existing == resource
- raise(ArgumentError, "Cannot alias %s to %s; resource %s already exists" % [resource.ref, key.inspect, newref.inspect])
+ raise(ArgumentError, "Cannot alias #{resource.ref} to #{key.inspect}; resource #{newref.inspect} already exists")
end
@resource_table[newref] = resource
@aliases[resource.ref] ||= []
@@ -148,10 +148,10 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
transaction.evaluate
rescue Puppet::Error => detail
puts detail.backtrace if Puppet[:trace]
- Puppet.err "Could not apply complete catalog: %s" % detail
+ Puppet.err "Could not apply complete catalog: #{detail}"
rescue => detail
puts detail.backtrace if Puppet[:trace]
- Puppet.err "Got an uncaught exception of type %s: %s" % [detail.class, detail]
+ Puppet.err "Got an uncaught exception of type #{detail.class}: #{detail}"
ensure
# Don't try to store state unless we're a host config
# too recursive.
@@ -190,7 +190,7 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
# Create a new resource and register it in the catalog.
def create_resource(type, options)
unless klass = Puppet::Type.type(type)
- raise ArgumentError, "Unknown resource type %s" % type
+ raise ArgumentError, "Unknown resource type #{type}"
end
return unless resource = klass.new(options)
@@ -238,7 +238,7 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
bucket = tmp || bucket
if child = target.to_trans
unless bucket
- raise "No bucket created for %s" % source
+ raise "No bucket created for #{source}"
end
bucket.push child
@@ -332,10 +332,10 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
vertex.autorequire(self).each do |edge|
unless @relationship_graph.edge?(edge.source, edge.target) # don't let automatic relationships conflict with manual ones.
unless @relationship_graph.edge?(edge.target, edge.source)
- vertex.debug "Autorequiring %s" % [edge.source]
+ vertex.debug "Autorequiring #{edge.source}"
@relationship_graph.add_edge(edge)
else
- vertex.debug "Skipping automatic relationship with %s" % (edge.source == vertex ? edge.target : edge.source)
+ vertex.debug "Skipping automatic relationship with #{(edge.source == vertex ? edge.target : edge.source)}"
end
end
end
@@ -491,7 +491,7 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
f.puts classes.join("\n")
end
rescue => detail
- Puppet.err "Could not create class file %s: %s" % [Puppet[:classfile], detail]
+ Puppet.err "Could not create class file #{Puppet[:classfile]}: #{detail}"
end
end
@@ -516,10 +516,10 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
return unless existing_resource = @resource_table[title_key_for_ref(resource.ref)]
# If we've gotten this far, it's a real conflict
- msg = "Duplicate definition: %s is already defined" % resource.ref
+ msg = "Duplicate definition: #{resource.ref} is already defined"
if existing_resource.file and existing_resource.line
- msg << " in file %s at line %s" % [existing_resource.file, existing_resource.line]
+ msg << " in file #{existing_resource.file} at line #{existing_resource.line}"
end
if resource.line or resource.file
@@ -581,11 +581,11 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
next if block_given? and yield edge.target
unless source = map[edge.source.ref]
- raise Puppet::DevError, "Could not find resource %s when converting %s resources" % [edge.source.ref, message]
+ raise Puppet::DevError, "Could not find resource #{edge.source.ref} when converting #{message} resources"
end
unless target = map[edge.target.ref]
- raise Puppet::DevError, "Could not find resource %s when converting %s resources" % [edge.target.ref, message]
+ raise Puppet::DevError, "Could not find resource #{edge.target.ref} when converting #{message} resources"
end
result.add_edge(source, target, edge.label)
diff --git a/lib/puppet/run.rb b/lib/puppet/run.rb
index 4e9c160de..1a1a98332 100644
--- a/lib/puppet/run.rb
+++ b/lib/puppet/run.rb
@@ -26,7 +26,7 @@ class Puppet::Run
valid_options = [:tags, :ignoreschedules]
options.each do |key, value|
- raise ArgumentError, "Run does not accept %s" % key unless valid_options.include?(key)
+ raise ArgumentError, "Run does not accept #{key}" unless valid_options.include?(key)
end
@options = options
diff --git a/lib/puppet/simple_graph.rb b/lib/puppet/simple_graph.rb
index 51382682c..aeb70af2e 100644
--- a/lib/puppet/simple_graph.rb
+++ b/lib/puppet/simple_graph.rb
@@ -59,7 +59,7 @@ class Puppet::SimpleGraph
# a false impression of what the degree is. That's just
# as expensive as just getting the edge list, so I've decided
# to only add this method.
- define_method("%s_edges" % direction) do
+ define_method("#{direction}_edges") do
@adjacencies[direction].values.inject([]) { |total, adjacent| total += adjacent.to_a; total }
end
end
@@ -207,7 +207,7 @@ class Puppet::SimpleGraph
# If we have any vertices left with non-zero in-degrees, then we've found a cycle.
if cycles = degree.find_all { |vertex, edges| edges.length > 0 } and cycles.length > 0
message = cycles.collect { |vertex, edges| edges.collect { |e| e.to_s }.join(", ") }.join(", ")
- raise Puppet::Error, "Found dependency cycles in the following relationships: %s; try using the '--graph' option and open the '.dot' files in OmniGraffle or GraphViz" % message
+ raise Puppet::Error, "Found dependency cycles in the following relationships: #{message}; try using the '--graph' option and open the '.dot' files in OmniGraffle or GraphViz"
end
return result
@@ -447,7 +447,7 @@ class Puppet::SimpleGraph
Puppet.settings.use(:graphing)
- file = File.join(Puppet[:graphdir], "%s.dot" % name.to_s)
+ file = File.join(Puppet[:graphdir], "#{name}.dot")
File.open(file, "w") { |f|
f.puts to_dot("name" => name.to_s.capitalize)
}
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
diff --git a/lib/puppet/sslcertificates.rb b/lib/puppet/sslcertificates.rb
index ae539cc74..6a0d19ca2 100755
--- a/lib/puppet/sslcertificates.rb
+++ b/lib/puppet/sslcertificates.rb
@@ -9,7 +9,7 @@ module Puppet::SSLCertificates
def self.mkcert(hash)
[:type, :name, :ttl, :issuer, :serial, :publickey].each { |param|
unless hash.include?(param)
- raise ArgumentError, "mkcert called without %s" % param
+ raise ArgumentError, "mkcert called without #{param}"
end
}
@@ -79,7 +79,7 @@ module Puppet::SSLCertificates
ext_key_usage = %w{clientAuth emailProtection}
ex << ef.create_extension("nsCertType", "client,email")
else
- raise Puppet::Error, "unknown cert type '%s'" % hash[:type]
+ raise Puppet::Error, "unknown cert type '#{hash[:type]}'"
end
@@ -116,7 +116,7 @@ module Puppet::SSLCertificates
hash = "%08x" % cert.issuer.hash
hashpath = nil
10.times { |i|
- path = File.join(dir, "%s.%s" % [hash, i])
+ path = File.join(dir, "#{hash}.#{i}")
if FileTest.exists?(path)
if FileTest.symlink?(path)
dest = File.readlink(path)
diff --git a/lib/puppet/sslcertificates/ca.rb b/lib/puppet/sslcertificates/ca.rb
index 5f32dd0a4..c2ed7349f 100644
--- a/lib/puppet/sslcertificates/ca.rb
+++ b/lib/puppet/sslcertificates/ca.rb
@@ -21,13 +21,13 @@ class Puppet::SSLCertificates::CA
if FileTest.exists?(file)
begin
if Puppet[:name] == "cert"
- puts "Removing %s" % file
+ puts "Removing #{file}"
else
- Puppet.info "Removing %s" % file
+ Puppet.info "Removing #{file}"
end
File.unlink(file)
rescue => detail
- raise Puppet::Error, "Could not delete %s: %s" % [file, detail]
+ raise Puppet::Error, "Could not delete #{file}: #{detail}"
end
end
@@ -57,8 +57,8 @@ class Puppet::SSLCertificates::CA
if Puppet[:capass]
if FileTest.exists?(Puppet[:capass])
- #puts "Reading %s" % Puppet[:capass]
- #system "ls -al %s" % Puppet[:capass]
+ #puts "Reading #{Puppet[:capass]}"
+ #system "ls -al #{Puppet[:capass]}"
#File.read Puppet[:capass]
@config[:password] = self.getpass
else
@@ -96,7 +96,7 @@ class Puppet::SSLCertificates::CA
if @config[:capass] and File.readable?(@config[:capass])
return File.read(@config[:capass])
else
- raise Puppet::Error, "Could not decrypt CA key with password: %s" % detail
+ raise Puppet::Error, "Could not decrypt CA key with password: #{detail}"
end
end
@@ -156,7 +156,7 @@ class Puppet::SSLCertificates::CA
# Make the root cert's name the FQDN of the host running the CA.
name = Facter["hostname"].value
if domain = Facter["domain"].value
- name += "." + domain
+ name += ".#{domain}"
end
cert = Certificate.new(
@@ -187,7 +187,7 @@ class Puppet::SSLCertificates::CA
def removeclientcsr(host)
csrfile = host2csrfile(host)
unless File.exists?(csrfile)
- raise Puppet::Error, "No certificate request for %s" % host
+ raise Puppet::Error, "No certificate request for #{host}"
end
File.unlink(csrfile)
@@ -227,12 +227,12 @@ class Puppet::SSLCertificates::CA
end
if hash.length > 0
- raise ArgumentError, "Unknown parameters %s" % hash.keys.join(",")
+ raise ArgumentError, "Unknown parameters #{hash.keys.join(",")}"
end
[:cadir, :csrdir, :signeddir].each { |dir|
unless @config[dir]
- raise Puppet::DevError, "%s is undefined" % dir
+ raise Puppet::DevError, "#{dir} is undefined"
end
}
end
@@ -241,7 +241,7 @@ class Puppet::SSLCertificates::CA
def sign(csr)
unless csr.is_a?(OpenSSL::X509::Request)
raise Puppet::Error,
- "CA#sign only accepts OpenSSL::X509::Request objects, not %s" % csr.class
+ "CA#sign only accepts OpenSSL::X509::Request objects, not #{csr.class}"
end
unless csr.verify(csr.public_key)
@@ -283,7 +283,7 @@ class Puppet::SSLCertificates::CA
csrfile = host2csrfile(host)
if File.exists?(csrfile)
- raise Puppet::Error, "Certificate request for %s already exists" % host
+ raise Puppet::Error, "Certificate request for #{host} already exists"
end
Puppet.settings.writesub(:csrdir, csrfile) do |f|
@@ -297,7 +297,7 @@ class Puppet::SSLCertificates::CA
certfile = host2certfile(host)
if File.exists?(certfile)
- Puppet.notice "Overwriting signed certificate %s for %s" % [certfile, host]
+ Puppet.notice "Overwriting signed certificate #{certfile} for #{host}"
end
Puppet::SSLCertificates::Inventory::add(cert)
diff --git a/lib/puppet/sslcertificates/certificate.rb b/lib/puppet/sslcertificates/certificate.rb
index d1acc1269..8df7605d7 100644
--- a/lib/puppet/sslcertificates/certificate.rb
+++ b/lib/puppet/sslcertificates/certificate.rb
@@ -106,7 +106,7 @@ class Puppet::SSLCertificates::Certificate
case hash[:type]
when :ca, :client, :server; @type = hash[:type]
else
- raise "Invalid Cert type %s" % hash[:type]
+ raise "Invalid Cert type #{hash[:type]}"
end
else
@type = :client
diff --git a/lib/puppet/sslcertificates/support.rb b/lib/puppet/sslcertificates/support.rb
index 6fa220f24..fc40d3538 100644
--- a/lib/puppet/sslcertificates/support.rb
+++ b/lib/puppet/sslcertificates/support.rb
@@ -10,10 +10,10 @@ module Puppet::SSLCertificates::Support
# Some metaprogramming to create methods for retrieving and creating keys.
# This probably isn't fewer lines than defining each separately...
def self.keytype(name, options, &block)
- var = "@%s" % name
+ var = "@#{name}"
- maker = "mk_%s" % name
- reader = "read_%s" % name
+ maker = "mk_#{name}"
+ reader = "read_#{name}"
unless param = options[:param]
raise ArgumentError, "You must specify the parameter for the key"
@@ -33,7 +33,7 @@ module Puppet::SSLCertificates::Support
begin
instance_variable_set(var, klass.new(File.read(Puppet[param])))
rescue => detail
- raise InvalidCertificate, "Could not read %s: %s" % [param, detail]
+ raise InvalidCertificate, "Could not read #{param}: #{detail}"
end
end
@@ -53,7 +53,7 @@ module Puppet::SSLCertificates::Support
# The key pair.
keytype :key, :param => :hostprivkey, :class => OpenSSL::PKey::RSA do
- Puppet.info "Creating a new SSL key at %s" % Puppet[:hostprivkey]
+ Puppet.info "Creating a new SSL key at #{Puppet[:hostprivkey]}"
key = OpenSSL::PKey::RSA.new(Puppet[:keylength])
# Our key meta programming can only handle one file, so we have
@@ -66,7 +66,7 @@ module Puppet::SSLCertificates::Support
# Our certificate request
keytype :csr, :param => :hostcsr, :class => OpenSSL::X509::Request do
- Puppet.info "Creating a new certificate request for %s" % Puppet[:certname]
+ Puppet.info "Creating a new certificate request for #{Puppet[:certname]}"
csr = OpenSSL::X509::Request.new
csr.version = 0
@@ -95,7 +95,7 @@ module Puppet::SSLCertificates::Support
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 == ""
@@ -111,7 +111,7 @@ module Puppet::SSLCertificates::Support
retrieved = true
rescue => detail
raise Puppet::Error.new(
- "Invalid certificate: %s" % detail
+ "Invalid certificate: #{detail}"
)
end
@@ -142,7 +142,7 @@ module Puppet::SSLCertificates::Support
full_file = File.join(dir, real_file)
- Puppet.notice "Fixing case in %s; renaming to %s" % [full_file, file]
+ Puppet.notice "Fixing case in #{full_file}; renaming to #{file}"
File.rename(full_file, file)
return true
diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb
index b7cb39b92..75b3140bb 100644
--- a/lib/puppet/transaction.rb
+++ b/lib/puppet/transaction.rb
@@ -74,7 +74,7 @@ class Puppet::Transaction
unless relationship_graph.edge?(edge[1], edge[0])
relationship_graph.add_edge(*edge)
else
- resource.debug "Skipping automatic relationship to %s" % gen_child
+ resource.debug "Skipping automatic relationship to #{gen_child}"
end
end
end
@@ -129,7 +129,7 @@ class Puppet::Transaction
prepare()
- Puppet.info "Applying configuration version '%s'" % catalog.version if catalog.version
+ Puppet.info "Applying configuration version '#{catalog.version}'" if catalog.version
begin
@sorted_resources.each do |resource|
@@ -188,7 +188,7 @@ class Puppet::Transaction
made = resource.send(method)
rescue => detail
puts detail.backtrace if Puppet[:trace]
- resource.err "Failed to generate additional resources using '%s': %s" % [method, detail]
+ resource.err "Failed to generate additional resources using '#{method}': #{detail}"
end
return [] unless made
made = [made] unless made.is_a?(Array)
@@ -260,14 +260,14 @@ class Puppet::Transaction
# Now call prefetch, passing in the resources so that the provider instances can be replaced.
prefetchers.each do |provider, resources|
- Puppet.debug "Prefetching %s resources for %s" % [provider.name, provider.resource_type.name]
+ Puppet.debug "Prefetching #{provider.name} resources for #{provider.resource_type.name}"
begin
provider.prefetch(resources)
rescue => detail
if Puppet[:trace]
puts detail.backtrace
end
- Puppet.err "Could not prefetch %s provider '%s': %s" % [provider.resource_type.name, provider.name, detail]
+ Puppet.err "Could not prefetch #{provider.resource_type.name} provider '#{provider.name}': #{detail}"
end
end
end
@@ -294,7 +294,7 @@ class Puppet::Transaction
begin
report = generate_report()
rescue => detail
- Puppet.err "Could not generate report: %s" % detail
+ Puppet.err "Could not generate report: #{detail}"
return
end
@@ -306,7 +306,7 @@ class Puppet::Transaction
begin
report.save()
rescue => detail
- Puppet.err "Reporting failed: %s" % detail
+ Puppet.err "Reporting failed: #{detail}"
end
end
end
@@ -327,7 +327,7 @@ class Puppet::Transaction
# Should this resource be skipped?
def skip?(resource)
if missing_tags?(resource)
- resource.debug "Not tagged with %s" % tags.join(", ")
+ resource.debug "Not tagged with #{tags.join(", ")}"
elsif ! scheduled?(resource)
resource.debug "Not scheduled"
elsif failed_dependencies?(resource)
diff --git a/lib/puppet/transaction/change.rb b/lib/puppet/transaction/change.rb
index 605457a21..18f11c016 100644
--- a/lib/puppet/transaction/change.rb
+++ b/lib/puppet/transaction/change.rb
@@ -63,7 +63,7 @@ class Puppet::Transaction::Change
end
def to_s
- return "change %s" % @property.change_to_s(@is, @should)
+ return "change #{@property.change_to_s(@is, @should)}"
end
private
diff --git a/lib/puppet/transaction/report.rb b/lib/puppet/transaction/report.rb
index 8e3812096..24e69ea7a 100644
--- a/lib/puppet/transaction/report.rb
+++ b/lib/puppet/transaction/report.rb
@@ -67,7 +67,7 @@ class Puppet::Transaction::Report
ret = ""
@metrics.sort { |a,b| a[1].label <=> b[1].label }.each do |name, metric|
- ret += "%s:\n" % metric.label
+ ret += "#{metric.label}:\n"
metric.values.sort { |a,b|
# sort by label
if a[0] == :total
diff --git a/lib/puppet/transportable.rb b/lib/puppet/transportable.rb
index 52747da66..01045243d 100644
--- a/lib/puppet/transportable.rb
+++ b/lib/puppet/transportable.rb
@@ -49,7 +49,7 @@ module Puppet
trans = TransObject.new(ref, :component)
@params.each { |param,value|
next unless Puppet::Type::Component.valid_parameter?(param)
- Puppet.debug "Defining %s on %s" % [param, ref]
+ Puppet.debug "Defining #{param} on #{ref}"
trans[param] = value
}
trans.catalog = self.catalog
@@ -61,7 +61,7 @@ module Puppet
end
def to_s
- return "%s(%s) => %s" % [@type,@name,super]
+ return "#{@type}(#{@name}) => #{super}"
end
def to_manifest
@@ -106,7 +106,7 @@ module Puppet
%w{delete shift include? length empty? << []}.each { |method|
define_method(method) do |*args|
- #Puppet.warning "Calling %s with %s" % [method, args.inspect]
+ #Puppet.warning "Calling #{method} with #{args.inspect}"
@children.send(method, *args)
#Puppet.warning @params.inspect
end
@@ -150,7 +150,7 @@ module Puppet
# nada
else
raise Puppet::DevError,
- "TransBuckets cannot handle objects of type %s" % arg.class
+ "TransBuckets cannot handle objects of type #{arg.class}"
end
}
@children += args
diff --git a/lib/puppet/type.rb b/lib/puppet/type.rb
index 3ac68c173..28afab3ef 100644
--- a/lib/puppet/type.rb
+++ b/lib/puppet/type.rb
@@ -234,7 +234,7 @@ class Type
end
def self.newstate(name, options = {}, &block)
- Puppet.warning "newstate() has been deprecrated; use newproperty(%s)" % name
+ Puppet.warning "newstate() has been deprecrated; use newproperty(#{name})"
newproperty(name, options, &block)
end
@@ -251,11 +251,11 @@ class Type
# a parent class.
unless options.is_a? Hash
raise Puppet::DevError,
- "Options must be a hash, not %s" % options.inspect
+ "Options must be a hash, not #{options.inspect}"
end
if @validproperties.include?(name)
- raise Puppet::DevError, "Class %s already has a property named %s" % [self.name, name]
+ raise Puppet::DevError, "Class #{self.name} already has a property named #{name}"
end
if parent = options[:parent]
@@ -347,7 +347,7 @@ class Type
# does the name reflect a valid parameter?
def self.validparameter?(name)
unless defined?(@parameters)
- raise Puppet::DevError, "Class %s has not defined parameters" % self
+ raise Puppet::DevError, "Class #{self} has not defined parameters"
end
if @paramhash.include?(name) or @@metaparamhash.include?(name)
return true
@@ -403,7 +403,7 @@ class Type
name = attr_alias(name)
unless self.class.validattr?(name)
- fail("Invalid parameter %s(%s)" % [name, name.inspect])
+ fail("Invalid parameter #{name}(#{name.inspect})")
end
if name == :name
@@ -426,14 +426,14 @@ class Type
name = attr_alias(name)
unless self.class.validattr?(name)
- fail("Invalid parameter %s" % [name])
+ fail("Invalid parameter #{name}")
end
if name == :name
name = name_var
end
if value.nil?
- raise Puppet::Error.new("Got nil value for %s" % name)
+ raise Puppet::Error.new("Got nil value for #{name}")
end
property = self.newattr(name)
@@ -442,7 +442,7 @@ class Type
# make sure the parameter doesn't have any errors
property.value = value
rescue => detail
- error = Puppet::Error.new("Parameter %s failed: %s" % [name, detail])
+ error = Puppet::Error.new("Parameter #{name} failed: #{detail}")
error.set_backtrace(detail.backtrace)
raise error
end
@@ -501,7 +501,7 @@ class Type
end
unless klass = self.class.attrclass(name)
- raise Puppet::Error, "Resource type %s does not support parameter %s" % [self.class.name, name]
+ raise Puppet::Error, "Resource type #{self.class.name} does not support parameter #{name}"
end
if @parameters.include?(name)
@@ -687,7 +687,7 @@ class Type
if property = @parameters[:ensure]
unless is.include? property
raise Puppet::DevError,
- "The is value is not in the is array for '%s'" % [property.name]
+ "The is value is not in the is array for '#{property.name}'"
end
ensureis = is[property]
if property.insync?(ensureis) and property.should == :absent
@@ -698,19 +698,19 @@ class Type
properties.each { |property|
unless is.include? property
raise Puppet::DevError,
- "The is value is not in the is array for '%s'" % [property.name]
+ "The is value is not in the is array for '#{property.name}'"
end
propis = is[property]
unless property.insync?(propis)
- property.debug("Not in sync: %s vs %s" % [propis.inspect, property.should.inspect])
+ property.debug("Not in sync: #{propis.inspect} vs #{property.should.inspect}")
insync = false
#else
# property.debug("In sync")
end
}
- #self.debug("%s sync status is %s" % [self,insync])
+ #self.debug("#{self} sync status is #{insync}")
return insync
end
@@ -809,13 +809,13 @@ class Type
end
if exobj = @objects[name] and self.isomorphic?
- msg = "Object '%s[%s]' already exists" % [newobj.class.name, name]
+ msg = "Object '#{newobj.class.name}[#{name}]' already exists"
if exobj.file and exobj.line
- msg += ("in file %s at line %s" % [object.file, object.line])
+ msg += ("in file #{object.file} at line #{object.line}")
end
if object.file and object.line
- msg += ("and cannot be redefined in file %s at line %s" % [object.file, object.line])
+ msg += ("and cannot be redefined in file #{object.file} at line #{object.line}")
end
error = Puppet::Error.new(msg)
raise error
@@ -833,7 +833,7 @@ class Type
if @objects.include?(name)
unless @objects[name] == obj
raise Puppet::Error.new(
- "Cannot create alias %s: object already exists" % [name]
+ "Cannot create alias #{name}: object already exists"
)
end
end
@@ -841,7 +841,7 @@ class Type
if @aliases.include?(name)
unless @aliases[name] == obj
raise Puppet::Error.new(
- "Object %s already has alias %s" % [@aliases[name].name, name]
+ "Object #{@aliases[name].name} already has alias #{name}"
)
end
end
@@ -910,7 +910,7 @@ class Type
# Retrieve all known instances. Either requires providers or must be overridden.
def self.instances
if provider_hash.empty?
- raise Puppet::DevError, "%s has no providers and has not overridden 'instances'" % self.name
+ raise Puppet::DevError, "#{self.name} has no providers and has not overridden 'instances'"
end
# Put the default provider first, then the rest of the suitable providers.
@@ -1129,7 +1129,7 @@ class Type
aliases.each do |other|
if obj = @resource.catalog.resource(@resource.class.name, other)
unless obj.object_id == @resource.object_id
- self.fail("%s can not create alias %s: object already exists" % [@resource.title, other])
+ self.fail("#{@resource.title} can not create alias #{other}: object already exists")
end
next
end
@@ -1189,7 +1189,7 @@ class Type
@value.each do |ref|
unless @resource.catalog.resource(ref.to_s)
description = self.class.direction == :in ? "dependency" : "dependent"
- fail "Could not find %s %s for %s" % [description, ref.to_s, resource.ref]
+ fail "Could not find #{description} #{ref} for #{resource.ref}"
end
end
end
@@ -1209,7 +1209,7 @@ class Type
# Either of the two retrieval attempts could have returned
# nil.
unless related_resource = reference.resolve
- self.fail "Could not retrieve dependency '%s' of %s" % [reference, @resource.ref]
+ self.fail "Could not retrieve dependency '#{reference}' of #{@resource.ref}"
end
# Are we requiring them, or vice versa? See the method docs
@@ -1227,12 +1227,12 @@ class Type
:event => self.class.events,
:callback => method
}
- self.debug("subscribes to %s" % [related_resource.ref])
+ self.debug("subscribes to #{related_resource.ref}")
else
# If there's no callback, there's no point in even adding
# a label.
subargs = nil
- self.debug("requires %s" % [related_resource.ref])
+ self.debug("requires #{related_resource.ref}")
end
rel = Puppet::Relationship.new(source, target, subargs)
@@ -1410,13 +1410,13 @@ class Type
retval = nil
if defaults.length > 1
Puppet.warning(
- "Found multiple default providers for %s: %s; using %s" % [self.name, defaults.collect { |i| i.name.to_s }.join(", "), defaults[0].name]
+ "Found multiple default providers for #{self.name}: #{defaults.collect { |i| i.name.to_s }.join(", ")}; using #{defaults[0].name}"
)
retval = defaults.shift
elsif defaults.length == 1
retval = defaults.shift
else
- raise Puppet::DevError, "Could not find a default provider for %s" % self.name
+ raise Puppet::DevError, "Could not find a default provider for #{self.name}"
end
@defaultprovider = retval
@@ -1462,7 +1462,7 @@ class Type
name = Puppet::Util.symbolize(name)
if obj = provider_hash[name]
- Puppet.debug "Reloading %s %s provider" % [name, self.name]
+ Puppet.debug "Reloading #{name} #{self.name} provider"
unprovide(name)
end
@@ -1475,7 +1475,7 @@ class Type
provider
else
raise Puppet::DevError,
- "Could not find parent provider %s of %s" % [pname, name]
+ "Could not find parent provider #{pname} of #{name}"
end
end
else
@@ -1523,7 +1523,7 @@ class Type
@doc + " Available providers are:\n\n" + parenttype().providers.sort { |a,b|
a.to_s <=> b.to_s
}.collect { |i|
- "* **%s**: %s" % [i, parenttype().provider(i).doc]
+ "* **#{i}**: #{parenttype().provider(i).doc}"
}.join("\n")
end
@@ -1538,7 +1538,7 @@ class Type
end
unless provider = @resource.class.provider(provider_class)
- raise ArgumentError, "Invalid %s provider '%s'" % [@resource.class.name, provider_class]
+ raise ArgumentError, "Invalid #{@resource.class.name} provider '#{provider_class}'"
end
end
@@ -1592,7 +1592,7 @@ class Type
elsif klass = self.class.provider(name)
@provider = klass.new(self)
else
- raise ArgumentError, "Could not find %s provider of %s" % [name, self.class.name]
+ raise ArgumentError, "Could not find #{name} provider of #{self.class.name}"
end
end
@@ -1720,7 +1720,7 @@ class Type
if hash.include?(key)
hash[key]
else
- "Param Documentation for %s not found" % key
+ "Param Documentation for #{key} not found"
end
}
@@ -1732,7 +1732,7 @@ class Type
def self.to_s
if defined?(@name)
- "Puppet::Type::" + @name.to_s.capitalize
+ "Puppet::Type::#{@name.to_s.capitalize}"
else
super
end
@@ -1836,7 +1836,7 @@ class Type
rescue ArgumentError, Puppet::Error, TypeError
raise
rescue => detail
- error = Puppet::DevError.new( "Could not set %s on %s: %s" % [attr, self.class.name, detail])
+ error = Puppet::DevError.new( "Could not set #{attr} on #{self.class.name}: #{detail}")
error.set_backtrace(detail.backtrace)
raise error
end
@@ -1883,7 +1883,7 @@ class Type
# Return the "type[name]" style reference.
def ref
- "%s[%s]" % [self.class.name.to_s.capitalize, self.title]
+ "#{self.class.name.to_s.capitalize}[#{self.title}]"
end
def self_refresh?
@@ -1914,7 +1914,7 @@ class Type
elsif self.class.validproperty?(name_var)
@title = self.should(name_var)
else
- self.devfail "Could not find namevar %s for %s" % [name_var, self.class.name]
+ self.devfail "Could not find namevar #{name_var} for #{self.class.name}"
end
end
diff --git a/lib/puppet/type/component.rb b/lib/puppet/type/component.rb
index b62954ba0..9fc05c115 100644
--- a/lib/puppet/type/component.rb
+++ b/lib/puppet/type/component.rb
@@ -72,7 +72,7 @@ Puppet::Type.newtype(:component) do
catalog.adjacent(self).each do |child|
if child.respond_to?(:refresh)
child.refresh
- child.log "triggering %s" % :refresh
+ child.log "triggering #{:refresh}"
end
end
end
diff --git a/lib/puppet/type/cron.rb b/lib/puppet/type/cron.rb
index 4151610f1..dee0dc3f1 100755
--- a/lib/puppet/type/cron.rb
+++ b/lib/puppet/type/cron.rb
@@ -197,7 +197,7 @@ Puppet::Type.newtype(:cron) do
if retval
return retval.to_s
else
- self.fail "%s is not a valid %s" % [value, self.class.name]
+ self.fail "#{value} is not a valid #{self.class.name}"
end
end
end
@@ -250,7 +250,7 @@ Puppet::Type.newtype(:cron) do
validate do |value|
unless specials().include?(value)
- raise ArgumentError, "Invalid special schedule %s" % value.inspect
+ raise ArgumentError, "Invalid special schedule #{value.inspect}"
end
end
end
@@ -311,7 +311,7 @@ Puppet::Type.newtype(:cron) do
validate do |value|
unless value =~ /^\s*(\w+)\s*=\s*(.*)\s*$/ or value == :absent or value == "absent"
- raise ArgumentError, "Invalid environment setting %s" % value.inspect
+ raise ArgumentError, "Invalid environment setting #{value.inspect}"
end
end
diff --git a/lib/puppet/type/exec.rb b/lib/puppet/type/exec.rb
index cd9c02034..ce662f152 100755
--- a/lib/puppet/type/exec.rb
+++ b/lib/puppet/type/exec.rb
@@ -147,7 +147,7 @@ module Puppet
end
unless self.should.include?(@status.exitstatus.to_s)
- self.fail("%s returned %s instead of one of [%s]" % [self.resource[:command], @status.exitstatus, self.should.join(",")])
+ self.fail("#{self.resource[:command]} returned #{@status.exitstatus} instead of one of [#{self.should.join(",")}]")
end
return event
@@ -264,7 +264,7 @@ module Puppet
values = [values] unless values.is_a? Array
values.each do |value|
unless value =~ /\w+=/
- raise ArgumentError, "Invalid environment setting '%s'" % value
+ raise ArgumentError, "Invalid environment setting '#{value}'"
end
end
end
@@ -432,7 +432,7 @@ module Puppet
begin
output, status = @resource.run(value, true)
rescue Timeout::Error
- err "Check %s exceeded timeout" % value.inspect
+ err "Check #{value.inspect} exceeded timeout"
return false
end
@@ -474,7 +474,7 @@ module Puppet
begin
output, status = @resource.run(value, true)
rescue Timeout::Error
- err "Check %s exceeded timeout" % value.inspect
+ err "Check #{value.inspect} exceeded timeout"
return false
end
@@ -568,7 +568,7 @@ module Puppet
path = %x{which #{exe}}.chomp
if path == ""
raise ArgumentError,
- "Could not find command '%s'" % exe
+ "Could not find command '#{exe}'"
else
exe = path
end
@@ -584,11 +584,11 @@ module Puppet
end
unless FileTest.exists?(exe)
- raise ArgumentError, "Could not find executable '%s'" % exe
+ raise ArgumentError, "Could not find executable '#{exe}'"
end
unless FileTest.executable?(exe)
raise ArgumentError,
- "'%s' is not executable" % exe
+ "'#{exe}' is not executable"
end
end
@@ -625,7 +625,7 @@ module Puppet
if check
dir = nil
else
- self.fail "Working directory '%s' does not exist" % dir
+ self.fail "Working directory '#{dir}' does not exist"
end
end
end
@@ -654,12 +654,12 @@ module Puppet
value = $2
if environment.include? name
warning(
- "Overriding environment setting '%s' with '%s'" % [name, value]
+ "Overriding environment setting '#{name}' with '#{value}'"
)
end
environment[name] = value
else
- warning "Cannot understand environment setting %s" % setting.inspect
+ warning "Cannot understand environment setting #{setting.inspect}"
end
end
end
@@ -687,7 +687,7 @@ module Puppet
exe = extractexe(cmd)
# if we're not fully qualified, require a path
if File.expand_path(exe) != exe and self[:path].nil?
- self.fail "'%s' is both unqualifed and specified no search path" % cmd
+ self.fail "'#{cmd}' is both unqualifed and specified no search path"
end
end
diff --git a/lib/puppet/type/file.rb b/lib/puppet/type/file.rb
index 08bc78327..6a9ec08e7 100644
--- a/lib/puppet/type/file.rb
+++ b/lib/puppet/type/file.rb
@@ -113,7 +113,7 @@ Puppet::Type.newtype(:file) do
when String
value
else
- self.fail "Invalid backup type %s" % value.inspect
+ self.fail "Invalid backup type #{value.inspect}"
end
end
end
@@ -281,7 +281,7 @@ Puppet::Type.newtype(:file) do
count += 1
end
if count > 1
- self.fail "You cannot specify more than one of %s" % CREATORS.collect { |p| p.to_s}.join(", ")
+ self.fail "You cannot specify more than one of #{CREATORS.collect { |p| p.to_s}.join(", ")}"
end
if !self[:source] and self[:recurse] == :remote
@@ -353,7 +353,7 @@ Puppet::Type.newtype(:file) do
end
unless catalog and filebucket = catalog.resource(:filebucket, backup) or backup == "puppet"
- fail "Could not find filebucket %s specified in backup" % backup
+ fail "Could not find filebucket #{backup} specified in backup"
end
return default_bucket unless filebucket
@@ -573,7 +573,7 @@ Puppet::Type.newtype(:file) do
total = self[:source].collect do |source|
next unless result = perform_recursion(source)
return if top = result.find { |r| r.relative_path == "." } and top.ftype != "directory"
- result.each { |data| data.source = "%s/%s" % [source, data.relative_path] }
+ result.each { |data| data.source = "#{source}/#{data.relative_path}" }
break result if result and ! result.empty? and sourceselect == :first
result
end.flatten
@@ -631,16 +631,16 @@ Puppet::Type.newtype(:file) do
case s.ftype
when "directory"
if self[:force] == :true
- debug "Removing existing directory for replacement with %s" % should
+ debug "Removing existing directory for replacement with #{should}"
FileUtils.rmtree(self[:path])
else
notice "Not removing directory; use 'force' to override"
end
when "link", "file"
- debug "Removing existing %s for replacement with %s" % [s.ftype, should]
+ debug "Removing existing #{s.ftype} for replacement with #{should}"
File.unlink(self[:path])
else
- self.fail "Could not back up files of type %s" % s.ftype
+ self.fail "Could not back up files of type #{s.ftype}"
end
expire
end
@@ -750,7 +750,7 @@ Puppet::Type.newtype(:file) do
fail_if_checksum_is_wrong(path, content_checksum) if validate_checksum?
File.rename(path, self[:path])
rescue => detail
- fail "Could not rename temporary file %s to %s: %s" % [path, self[:path], detail]
+ fail "Could not rename temporary file #{path} to #{self[:path]}: #{detail}"
ensure
# Make sure the created file gets removed
File.unlink(path) if FileTest.exists?(path)
@@ -774,7 +774,7 @@ Puppet::Type.newtype(:file) do
newsum = parameter(:checksum).sum_file(path)
return if [:absent, nil, content_checksum].include?(newsum)
- self.fail "File written to disk did not match checksum; discarding changes (%s vs %s)" % [content_checksum, newsum]
+ self.fail "File written to disk did not match checksum; discarding changes (#{content_checksum} vs #{newsum})"
end
# write the current content. Note that if there is no content property
diff --git a/lib/puppet/type/file/content.rb b/lib/puppet/type/file/content.rb
index 8d832a6d1..7f9729292 100755
--- a/lib/puppet/type/file/content.rb
+++ b/lib/puppet/type/file/content.rb
@@ -56,11 +56,11 @@ module Puppet
newvalue = tmp
end
if currentvalue == :absent
- return "defined content as '%s'" % [newvalue]
+ return "defined content as '#{newvalue}'"
elsif newvalue == :absent
- return "undefined content from '%s'" % [currentvalue]
+ return "undefined content from '#{currentvalue}'"
else
- return "content changed '%s' to '%s'" % [currentvalue, newvalue]
+ return "content changed '#{currentvalue}' to '#{newvalue}'"
end
end
@@ -192,7 +192,7 @@ module Puppet
when /^2/; uncompress(response) { |uncompressor| response.read_body { |chunk| yield uncompressor.uncompress(chunk) } }
else
# Raise the http error if we didn't get a 'success' of some kind.
- message = "Error %s on SERVER: %s" % [response.code, (response.body||'').empty? ? response.message : uncompress_body(response)]
+ message = "Error #{response.code} on SERVER: #{(response.body||'').empty? ? response.message : uncompress_body(response)}"
raise Net::HTTPError.new(message, response)
end
end
diff --git a/lib/puppet/type/file/ensure.rb b/lib/puppet/type/file/ensure.rb
index 1a7fe5e4f..ab2419c5f 100755
--- a/lib/puppet/type/file/ensure.rb
+++ b/lib/puppet/type/file/ensure.rb
@@ -62,7 +62,7 @@ module Puppet
parent = File.dirname(@resource[:path])
unless FileTest.exists? parent
raise Puppet::Error,
- "Cannot create %s; parent directory %s does not exist" % [@resource[:path], parent]
+ "Cannot create #{@resource[:path]}; parent directory #{parent} does not exist"
end
if mode
Puppet::Util.withumask(000) do
@@ -122,10 +122,10 @@ module Puppet
if ! FileTest.exists?(basedir)
raise Puppet::Error,
- "Can not create %s; parent directory does not exist" % @resource.title
+ "Can not create #{@resource.title}; parent directory does not exist"
elsif ! FileTest.directory?(basedir)
raise Puppet::Error,
- "Can not create %s; %s is not a directory" % [@resource.title, dirname]
+ "Can not create #{@resource.title}; #{dirname} is not a directory"
end
end
diff --git a/lib/puppet/type/file/group.rb b/lib/puppet/type/file/group.rb
index e3d7b4ec6..ddfe8381e 100755
--- a/lib/puppet/type/file/group.rb
+++ b/lib/puppet/type/file/group.rb
@@ -11,7 +11,7 @@ module Puppet
@event = :file_changed
validate do |group|
- raise(Puppet::Error, "Invalid group name '%s'" % group.inspect) unless group and group != ""
+ raise(Puppet::Error, "Invalid group name '#{group.inspect}'") unless group and group != ""
end
def id2name(id)
@@ -51,7 +51,7 @@ module Puppet
if value =~ /^\d+$/
gid = Integer(value)
elsif value.is_a?(String)
- fail "Could not find group %s" % value unless gid = gid(value)
+ fail "Could not find group #{value}" unless gid = gid(value)
else
gid = value
end
@@ -70,7 +70,7 @@ module Puppet
# large GIDs instead of negative ones. This isn't a Ruby bug,
# it's an OS X bug, since it shows up in perl, too.
if currentvalue > Puppet[:maximum_uid].to_i
- self.warning "Apparently using negative GID (%s) on a platform that does not consistently handle them" % currentvalue
+ self.warning "Apparently using negative GID (#{currentvalue}) on a platform that does not consistently handle them"
currentvalue = :silly
end
@@ -108,13 +108,13 @@ module Puppet
break if gid = validgroup?(group)
end
- raise Puppet::Error, "Could not find group(s) %s" % @should.join(",") unless gid
+ raise Puppet::Error, "Could not find group(s) #{@should.join(",")}" unless gid
begin
# set owner to nil so it's ignored
File.send(method, nil, gid, resource[:path])
rescue => detail
- error = Puppet::Error.new( "failed to chgrp %s to %s: %s" % [resource[:path], gid, detail.message])
+ error = Puppet::Error.new( "failed to chgrp #{resource[:path]} to #{gid}: #{detail.message}")
raise error
end
return :file_changed
diff --git a/lib/puppet/type/file/mode.rb b/lib/puppet/type/file/mode.rb
index 71cd1b4ae..da54b9fdd 100755
--- a/lib/puppet/type/file/mode.rb
+++ b/lib/puppet/type/file/mode.rb
@@ -34,7 +34,7 @@ module Puppet
when Symbol
return currentvalue
else
- raise Puppet::DevError, "Invalid current value for mode: %s" % currentvalue.inspect
+ raise Puppet::DevError, "Invalid current value for mode: #{currentvalue.inspect}"
end
end
@@ -45,7 +45,7 @@ module Puppet
when Symbol
return newvalue
else
- raise Puppet::DevError, "Invalid 'should' value for mode: %s" % newvalue.inspect
+ raise Puppet::DevError, "Invalid 'should' value for mode: #{newvalue.inspect}"
end
end
@@ -55,17 +55,17 @@ module Puppet
value = should
if value.is_a?(String)
unless value =~ /^\d+$/
- raise Puppet::Error, "File modes can only be numbers, not %s" % value.inspect
+ raise Puppet::Error, "File modes can only be numbers, not #{value.inspect}"
end
# Make sure our number looks like octal.
unless value =~ /^0/
- value = "0" + value
+ value = "0#{value}"
end
old = value
begin
value = Integer(value)
rescue ArgumentError => detail
- raise Puppet::DevError, "Could not convert %s to integer" % old.inspect
+ raise Puppet::DevError, "Could not convert #{old.inspect} to integer"
end
end
@@ -121,7 +121,7 @@ module Puppet
begin
File.chmod(mode, @resource[:path])
rescue => detail
- error = Puppet::Error.new("failed to chmod %s: %s" % [@resource[:path], detail.message])
+ error = Puppet::Error.new("failed to chmod #{@resource[:path]}: #{detail.message}")
error.set_backtrace detail.backtrace
raise error
end
diff --git a/lib/puppet/type/file/owner.rb b/lib/puppet/type/file/owner.rb
index a610a85e3..05754efcc 100755
--- a/lib/puppet/type/file/owner.rb
+++ b/lib/puppet/type/file/owner.rb
@@ -23,7 +23,7 @@ module Puppet
when String
newvalue
else
- raise Puppet::DevError, "Invalid uid type %s(%s)" % [newvalue.class, newvalue]
+ raise Puppet::DevError, "Invalid uid type #{newvalue.class}(#{newvalue})"
end
end
@@ -34,7 +34,7 @@ module Puppet
if tmp = provider.validuser?(val)
val = tmp
else
- raise "Could not find user %s" % val
+ raise "Could not find user #{val}"
end
else
val
diff --git a/lib/puppet/type/file/source.rb b/lib/puppet/type/file/source.rb
index fd32f13d6..74cd4c028 100755
--- a/lib/puppet/type/file/source.rb
+++ b/lib/puppet/type/file/source.rb
@@ -69,11 +69,11 @@ module Puppet
begin
uri = URI.parse(URI.escape(source))
rescue => detail
- self.fail "Could not understand source %s: %s" % [source, detail.to_s]
+ self.fail "Could not understand source #{source}: #{detail}"
end
unless uri.scheme.nil? or %w{file puppet}.include?(uri.scheme)
- self.fail "Cannot use URLs of type '%s' as source for fileserving" % [uri.scheme]
+ self.fail "Cannot use URLs of type '#{uri.scheme}' as source for fileserving"
end
end
end
@@ -84,11 +84,11 @@ module Puppet
end
def change_to_s(currentvalue, newvalue)
- # newvalue = "{md5}" + @metadata.checksum
+ # newvalue = "{md5}#{@metadata.checksum}"
if @resource.property(:ensure).retrieve == :absent
- return "creating from source %s with contents %s" % [metadata.source, metadata.checksum]
+ return "creating from source #{metadata.source} with contents #{metadata.checksum}"
else
- return "replacing from source %s with contents %s" % [metadata.source, metadata.checksum]
+ return "replacing from source #{metadata.source} with contents #{metadata.checksum}"
end
end
@@ -148,10 +148,10 @@ module Puppet
break
end
rescue => detail
- fail detail, "Could not retrieve file metadata for %s: %s" % [source, detail]
+ fail detail, "Could not retrieve file metadata for #{source}: #{detail}"
end
end
- fail "Could not retrieve information from source(s) %s" % value.join(", ") unless result
+ fail "Could not retrieve information from source(s) #{value.join(", ")}" unless result
result
end
diff --git a/lib/puppet/type/filebucket.rb b/lib/puppet/type/filebucket.rb
index 73cd56cd7..dd6d1d63e 100755
--- a/lib/puppet/type/filebucket.rb
+++ b/lib/puppet/type/filebucket.rb
@@ -85,7 +85,7 @@ module Puppet
@bucket = Puppet::FileBucket::Dipper.new(args)
rescue => detail
puts detail.backtrace if Puppet[:trace]
- self.fail("Could not create %s filebucket: %s" % [type, detail])
+ self.fail("Could not create #{type} filebucket: #{detail}")
end
@bucket.name = self.name
diff --git a/lib/puppet/type/group.rb b/lib/puppet/type/group.rb
index 54563bf2c..aa5031f0c 100755
--- a/lib/puppet/type/group.rb
+++ b/lib/puppet/type/group.rb
@@ -51,11 +51,11 @@ module Puppet
if gid =~ /^[-0-9]+$/
gid = Integer(gid)
else
- self.fail "Invalid GID %s" % gid
+ self.fail "Invalid GID #{gid}"
end
when Symbol
unless gid == :absent
- self.devfail "Invalid GID %s" % gid
+ self.devfail "Invalid GID #{gid}"
end
end
diff --git a/lib/puppet/type/host.rb b/lib/puppet/type/host.rb
index 5bfcd239c..0b830158c 100755
--- a/lib/puppet/type/host.rb
+++ b/lib/puppet/type/host.rb
@@ -38,7 +38,7 @@ module Puppet
when Array
# nothing
else
- raise Puppet::DevError, "Invalid @is type %s" % is.class
+ raise Puppet::DevError, "Invalid @is type #{is.class}"
end
return is
end
diff --git a/lib/puppet/type/k5login.rb b/lib/puppet/type/k5login.rb
index 5526fda21..e192ce479 100644
--- a/lib/puppet/type/k5login.rb
+++ b/lib/puppet/type/k5login.rb
@@ -76,7 +76,7 @@ Puppet::Type.newtype(:k5login) do
# Set the file mode, converting from a string to an integer.
def mode=(value)
- File.chmod(Integer("0" + value), @resource[:name])
+ File.chmod(Integer("0#{value}"), @resource[:name])
end
private
diff --git a/lib/puppet/type/package.rb b/lib/puppet/type/package.rb
index 4fee3b496..6c5b0702b 100644
--- a/lib/puppet/type/package.rb
+++ b/lib/puppet/type/package.rb
@@ -80,7 +80,7 @@ module Puppet
begin
provider.update
rescue => detail
- self.fail "Could not update: %s" % detail
+ self.fail "Could not update: #{detail}"
end
if current == :absent
@@ -94,7 +94,7 @@ module Puppet
begin
provider.install
rescue => detail
- self.fail "Could not update: %s" % detail
+ self.fail "Could not update: #{detail}"
end
if self.retrieve == :absent
@@ -133,7 +133,7 @@ module Puppet
@latest = provider.latest
@lateststamp = Time.now.to_i
rescue => detail
- error = Puppet::Error.new("Could not get latest version: %s" % detail.to_s)
+ error = Puppet::Error.new("Could not get latest version: #{detail}")
error.set_backtrace(detail.backtrace)
raise error
end
@@ -147,7 +147,7 @@ module Puppet
# that can't query versions.
return true
else
- self.debug "%s %s is installed, latest is %s" % [@resource.name, is.inspect, @latest.inspect]
+ self.debug "#{@resource.name} #{is.inspect} is installed, latest is #{@latest.inspect}"
end
when :absent
return true if is == :absent or is == :purged
diff --git a/lib/puppet/type/port.rb b/lib/puppet/type/port.rb
index 6b9ace239..e19988515 100755
--- a/lib/puppet/type/port.rb
+++ b/lib/puppet/type/port.rb
@@ -44,7 +44,7 @@
# valids = ["udp", "tcp", "ddp", :absent]
# unless valids.include? value
# raise Puppet::Error,
-# "Protocols can be either 'udp' or 'tcp', not %s" % value
+# "Protocols can be either 'udp' or 'tcp', not #{value}"
# end
# end
# end
diff --git a/lib/puppet/type/resources.rb b/lib/puppet/type/resources.rb
index 8e0649118..1fb866043 100644
--- a/lib/puppet/type/resources.rb
+++ b/lib/puppet/type/resources.rb
@@ -15,7 +15,7 @@ Puppet::Type.newtype(:resources) do
validate do |name|
unless Puppet::Type.type(name)
- raise ArgumentError, "Could not find resource type '%s'" % name
+ raise ArgumentError, "Could not find resource type '#{name}'"
end
end
@@ -32,7 +32,7 @@ Puppet::Type.newtype(:resources) do
validate do |value|
if [:true, true, "true"].include?(value)
unless @resource.resource_type.respond_to?(:instances)
- raise ArgumentError, "Purging resources of type %s is not supported, since they cannot be queried from the system" % @resource[:name]
+ raise ArgumentError, "Purging resources of type #{@resource[:name]} is not supported, since they cannot be queried from the system"
end
unless @resource.resource_type.validproperty?(:ensure)
raise ArgumentError, "Purging is only supported on types that accept 'ensure'"
@@ -58,7 +58,7 @@ Puppet::Type.newtype(:resources) do
false
when Integer; value
else
- raise ArgumentError, "Invalid value %s" % value.inspect
+ raise ArgumentError, "Invalid value #{value.inspect}"
end
end
@@ -73,7 +73,7 @@ Puppet::Type.newtype(:resources) do
def check(resource)
unless defined?(@checkmethod)
- @checkmethod = "%s_check" % self[:name]
+ @checkmethod = "#{self[:name]}_check"
end
unless defined?(@hascheck)
@hascheck = respond_to?(@checkmethod)
diff --git a/lib/puppet/type/schedule.rb b/lib/puppet/type/schedule.rb
index e52249ac1..c35c97ab3 100755
--- a/lib/puppet/type/schedule.rb
+++ b/lib/puppet/type/schedule.rb
@@ -81,7 +81,7 @@ module Puppet
values.each { |value|
unless value.is_a?(String) and
value =~ /\d+(:\d+){0,2}\s*-\s*\d+(:\d+){0,2}/
- self.fail "Invalid range value '%s'" % value
+ self.fail "Invalid range value '#{value}'"
end
}
end
@@ -99,23 +99,23 @@ module Puppet
}
if range.length != 2
- self.fail "Invalid range %s" % value
+ self.fail "Invalid range #{value}"
end
# Make sure the hours are valid
[range[0][0], range[1][0]].each do |n|
if n < 0 or n > 23
- raise ArgumentError, "Invalid hour '%s'" % n
+ raise ArgumentError, "Invalid hour '#{n}'"
end
end
[range[0][1], range[1][1]].each do |n|
if n and (n < 0 or n > 59)
- raise ArgumentError, "Invalid minute '%s'" % n
+ raise ArgumentError, "Invalid minute '#{n}'"
end
end
if range[0][0] > range[1][0]
- self.fail(("Invalid range %s; " % value) +
+ self.fail(("Invalid range #{value}; ") +
"ranges cannot span days."
)
end
@@ -153,7 +153,7 @@ module Puppet
unless time.hour == range[0]
self.devfail(
- "Incorrectly converted time: %s: %s vs %s" % [time, time.hour, range[0]]
+ "Incorrectly converted time: #{time}: #{time.hour} vs #{range[0]}"
)
end
@@ -291,7 +291,7 @@ module Puppet
if value != 1 and @resource[:periodmatch] != :distance
raise Puppet::Error,
- "Repeat must be 1 unless periodmatch is 'distance', not '%s'" % @resource[:periodmatch]
+ "Repeat must be 1 unless periodmatch is 'distance', not '#{@resource[:periodmatch]}'"
end
end
diff --git a/lib/puppet/type/ssh_authorized_key.rb b/lib/puppet/type/ssh_authorized_key.rb
index dc9193620..ac59823ce 100644
--- a/lib/puppet/type/ssh_authorized_key.rb
+++ b/lib/puppet/type/ssh_authorized_key.rb
@@ -47,7 +47,7 @@ module Puppet
return nil unless user = resource[:user]
begin
- return File.expand_path("~%s/.ssh/authorized_keys" % user)
+ return File.expand_path("~#{user}/.ssh/authorized_keys")
rescue
Puppet.debug "The required user is not yet present on the system"
return nil
diff --git a/lib/puppet/type/tidy.rb b/lib/puppet/type/tidy.rb
index 5eb01194c..63b2ae244 100755
--- a/lib/puppet/type/tidy.rb
+++ b/lib/puppet/type/tidy.rb
@@ -36,7 +36,7 @@ Puppet::Type.newtype(:tidy) do
when Integer, Fixnum, Bignum; value
when /^\d+$/; Integer(value)
else
- raise ArgumentError, "Invalid recurse value %s" % value.inspect
+ raise ArgumentError, "Invalid recurse value #{value.inspect}"
end
end
end
@@ -112,7 +112,7 @@ Puppet::Type.newtype(:tidy) do
if num = @@ageconvertors[unit]
return num * multi
else
- self.fail "Invalid age unit '%s'" % unit
+ self.fail "Invalid age unit '#{unit}'"
end
end
@@ -135,7 +135,7 @@ Puppet::Type.newtype(:tidy) do
multi = Integer($1)
unit = :d
else
- self.fail "Invalid tidy age %s" % age
+ self.fail "Invalid tidy age #{age}"
end
convert(unit, multi)
@@ -162,7 +162,7 @@ Puppet::Type.newtype(:tidy) do
num.times do result *= 1024 end
return result
else
- self.fail "Invalid size unit '%s'" % unit
+ self.fail "Invalid size unit '#{unit}'"
end
end
@@ -183,7 +183,7 @@ Puppet::Type.newtype(:tidy) do
multi = Integer($1)
unit = :k
else
- self.fail "Invalid tidy size %s" % age
+ self.fail "Invalid tidy size #{age}"
end
convert(unit, multi)
@@ -267,7 +267,7 @@ Puppet::Type.newtype(:tidy) do
else
files = [self[:path]]
end
- result = files.find_all { |path| tidy?(path) }.collect { |path| mkfile(path) }.each { |file| notice "Tidying %s" % file.ref }.sort { |a,b| b[:path] <=> a[:path] }
+ result = files.find_all { |path| tidy?(path) }.collect { |path| mkfile(path) }.each { |file| notice "Tidying #{file.ref}" }.sort { |a,b| b[:path] <=> a[:path] }
# No need to worry about relationships if we don't have rmdirs; there won't be
# any directories.
@@ -300,7 +300,7 @@ Puppet::Type.newtype(:tidy) do
if self[:matches].find {|pattern| File.fnmatch(pattern, basename, flags) }
return true
else
- debug "No specified patterns match %s, not tidying" % path
+ debug "No specified patterns match #{path}, not tidying"
return false
end
end
diff --git a/lib/puppet/type/user.rb b/lib/puppet/type/user.rb
index b3c8619ec..5788c39de 100755
--- a/lib/puppet/type/user.rb
+++ b/lib/puppet/type/user.rb
@@ -121,7 +121,7 @@ module Puppet
end
end
- fail "Could not find group(s) %s" % @should.join(",") unless found
+ fail "Could not find group(s) #{@should.join(",")}" unless found
# Use the default event.
end
@@ -208,7 +208,7 @@ module Puppet
validate do |val|
if val.to_s == "true"
unless provider.class.manages_homedir?
- raise ArgumentError, "User provider %s can not manage home directories" % provider.class.name
+ raise ArgumentError, "User provider #{provider.class.name} can not manage home directories"
end
end
end
diff --git a/lib/puppet/type/zone.rb b/lib/puppet/type/zone.rb
index 97b8d126f..5573241ed 100644
--- a/lib/puppet/type/zone.rb
+++ b/lib/puppet/type/zone.rb
@@ -123,10 +123,10 @@ Puppet::Type.newtype(:zone) do
def self.state_sequence(first, second)
findex = sindex = nil
unless findex = @parametervalues.index(state_name(first))
- raise ArgumentError, "'%s' is not a valid zone state" % first
+ raise ArgumentError, "'#{first}' is not a valid zone state"
end
unless sindex = @parametervalues.index(state_name(second))
- raise ArgumentError, "'%s' is not a valid zone state" % first
+ raise ArgumentError, "'#{first}' is not a valid zone state"
end
list = nil
@@ -172,11 +172,11 @@ Puppet::Type.newtype(:zone) do
end
provider.send(method)
else
- raise Puppet::DevError, "Cannot move %s from %s" % [direction, st[:name]]
+ raise Puppet::DevError, "Cannot move #{direction} from #{st[:name]}"
end
end
- return ("zone_" + self.should.to_s).intern
+ return ("zone_#{self.should}").intern
end
# Are we moving up the property tree?
@@ -394,7 +394,7 @@ Puppet::Type.newtype(:zone) do
begin
IPAddr.new(ip) if ip
rescue ArgumentError
- self.fail "'%s' is an invalid %s" % [ip, name]
+ self.fail "'#{ip}' is an invalid #{name}"
end
end
@@ -411,7 +411,7 @@ Puppet::Type.newtype(:zone) do
end
else
unless interface && address.nil? && defrouter.nil?
- self.fail "only interface may be specified when using exclusive IP stack: %s" % value
+ self.fail "only interface may be specified when using exclusive IP stack: #{value}"
end
end
diff --git a/lib/puppet/type/zpool.rb b/lib/puppet/type/zpool.rb
index 85f394fa0..48fe9a227 100755
--- a/lib/puppet/type/zpool.rb
+++ b/lib/puppet/type/zpool.rb
@@ -85,7 +85,7 @@ module Puppet
validate do
has_should = [:disk, :mirror, :raidz].select { |prop| self.should(prop) }
if has_should.length > 1
- self.fail "You cannot specify %s on this type (only one)" % has_should.join(" and ")
+ self.fail "You cannot specify #{has_should.join(" and ")} on this type (only one)"
end
end
end
diff --git a/lib/puppet/util.rb b/lib/puppet/util.rb
index 1f974921e..02bac1b88 100644
--- a/lib/puppet/util.rb
+++ b/lib/puppet/util.rb
@@ -31,15 +31,15 @@ module Util
if group = Puppet[:group]
group = self.gid(group)
unless group
- raise Puppet::Error, "No such group %s" % Puppet[:group]
+ raise Puppet::Error, "No such group #{Puppet[:group]}"
end
unless Puppet::Util::SUIDManager.gid == group
begin
Puppet::Util::SUIDManager.egid = group
Puppet::Util::SUIDManager.gid = group
rescue => detail
- Puppet.warning "could not change to group %s: %s" % [group.inspect, detail]
- $stderr.puts "could not change to group %s" % group.inspect
+ Puppet.warning "could not change to group #{group.inspect}: #{detail}"
+ $stderr.puts "could not change to group #{group.inspect}"
# Don't exit on failed group changes, since it's
# not fatal
@@ -51,7 +51,7 @@ module Util
if user = Puppet[:user]
user = self.uid(user)
unless user
- raise Puppet::Error, "No such user %s" % Puppet[:user]
+ raise Puppet::Error, "No such user #{Puppet[:user]}"
end
unless Puppet::Util::SUIDManager.uid == user
begin
@@ -59,7 +59,7 @@ module Util
Puppet::Util::SUIDManager.uid = user
Puppet::Util::SUIDManager.euid = user
rescue => detail
- $stderr.puts "Could not change to user %s: %s" % [user, detail]
+ $stderr.puts "Could not change to user #{user}: #{detail}"
exit(74)
end
end
@@ -135,7 +135,7 @@ module Util
elsif FileTest.directory?(File.join(path))
next
else FileTest.exist?(File.join(path))
- raise "Cannot create %s: basedir %s is a file" % [dir, File.join(path)]
+ raise "Cannot create #{dir}: basedir #{File.join(path)} is a file"
end
}
return true
@@ -173,7 +173,7 @@ module Util
end
unless level == :none or object.respond_to? level
- raise Puppet::DevError, "Benchmarked object does not respond to %s" % level
+ raise Puppet::DevError, "Benchmarked object does not respond to #{level}"
end
# Only benchmark if our log level is high enough
@@ -205,9 +205,9 @@ module Util
# Execute the provided command in a pipe, yielding the pipe object.
def execpipe(command, failonfail = true)
if respond_to? :debug
- debug "Executing '%s'" % command
+ debug "Executing '#{command}'"
else
- Puppet.debug "Executing '%s'" % command
+ Puppet.debug "Executing '#{command}'"
end
output = open("| #{command} 2>&1") do |pipe|
@@ -249,9 +249,9 @@ module Util
end
if respond_to? :debug
- debug "Executing '%s'" % str
+ debug "Executing '#{str}'"
else
- Puppet.debug "Executing '%s'" % str
+ Puppet.debug "Executing '#{str}'"
end
if arguments[:uid]
@@ -321,7 +321,7 @@ module Util
end # if child_pid
elsif Puppet.features.microsoft_windows?
command = command.collect {|part| '"' + part.gsub(/"/, '\\"') + '"'}.join(" ") if command.is_a?(Array)
- Puppet.debug "Creating process '%s'" % command
+ Puppet.debug "Creating process '#{command}'"
processinfo = Process.create( :command_line => command )
child_status = (Process.waitpid2(child_pid)[1]).to_i >> 8
end # if posix or win32
@@ -356,7 +356,7 @@ module Util
if arguments[:failonfail]
unless child_status == 0
- raise ExecutionFailure, "Execution of '%s' returned %s: %s" % [str, child_status, output]
+ raise ExecutionFailure, "Execution of '#{str}' returned #{child_status}: #{output}"
end
end
diff --git a/lib/puppet/util/autoload.rb b/lib/puppet/util/autoload.rb
index f0be0ece2..cdfc194da 100644
--- a/lib/puppet/util/autoload.rb
+++ b/lib/puppet/util/autoload.rb
@@ -24,7 +24,7 @@ class Puppet::Util::Autoload
# List all loaded files.
def self.list_loaded
@loaded.sort { |a,b| a[0] <=> b[0] }.collect do |path, hash|
- "%s: %s" % [path, hash[:file]]
+ "#{path}: #{hash[:file]}"
end
end
@@ -62,7 +62,7 @@ class Puppet::Util::Autoload
begin
self.send(opt.to_s + "=", value)
rescue NoMethodError
- raise ArgumentError, "%s is not a valid option" % opt
+ raise ArgumentError, "#{opt} is not a valid option"
end
end
diff --git a/lib/puppet/util/backups.rb b/lib/puppet/util/backups.rb
index 4270f528c..e08bf57de 100644
--- a/lib/puppet/util/backups.rb
+++ b/lib/puppet/util/backups.rb
@@ -49,7 +49,7 @@ module Puppet::Util::Backups
rescue => detail
# since they said they want a backup, let's error out
# if we couldn't make one
- self.fail "Could not back %s up: %s" % [file, detail.message]
+ self.fail "Could not back #{file} up: #{detail.message}"
end
end
@@ -67,22 +67,22 @@ module Puppet::Util::Backups
end
if stat.ftype == "directory"
- raise Puppet::Error, "Will not remove directory backup %s; use a filebucket" % newfile
+ raise Puppet::Error, "Will not remove directory backup #{newfile}; use a filebucket"
end
- info "Removing old backup of type %s" % stat.ftype
+ info "Removing old backup of type #{stat.ftype}"
begin
File.unlink(newfile)
rescue => detail
puts detail.backtrace if Puppet[:trace]
- self.fail "Could not remove old backup: %s" % detail
+ self.fail "Could not remove old backup: #{detail}"
end
end
def backup_file_with_filebucket(f)
sum = self.bucket.backup(f)
- self.info "Filebucketed %s to %s with sum %s" % [f, self.bucket.name, sum]
+ self.info "Filebucketed #{f} to #{self.bucket.name} with sum #{sum}"
return sum
end
end
diff --git a/lib/puppet/util/cacher.rb b/lib/puppet/util/cacher.rb
index 28786ab53..3a75dc88d 100644
--- a/lib/puppet/util/cacher.rb
+++ b/lib/puppet/util/cacher.rb
@@ -39,7 +39,7 @@ module Puppet::Util::Cacher
# Provide a means of defining an attribute whose value will be cached.
# Must provide a block capable of defining the value if it's flushed..
def cached_attr(name, options = {}, &block)
- init_method = "init_" + name.to_s
+ init_method = "init_#{name}"
define_method(init_method, &block)
define_method(name) do
@@ -103,7 +103,7 @@ module Puppet::Util::Cacher
value_cache.delete(name)
end
unless value_cache.include?(name)
- value_cache[name] = send("init_%s" % name)
+ value_cache[name] = send("init_#{name}")
end
value_cache[name]
end
diff --git a/lib/puppet/util/classgen.rb b/lib/puppet/util/classgen.rb
index 83c302c01..d9022bbdc 100644
--- a/lib/puppet/util/classgen.rb
+++ b/lib/puppet/util/classgen.rb
@@ -134,11 +134,11 @@ module Puppet::Util::ClassGen
if const_defined?(const)
if options[:overwrite]
- Puppet.info "Redefining %s in %s" % [name, self]
+ Puppet.info "Redefining #{name} in #{self}"
remove_const(const)
else
raise Puppet::ConstantAlreadyDefined,
- "Class %s is already defined in %s" % [const, self]
+ "Class #{const} is already defined in #{self}"
end
end
const_set(const, klass)
@@ -185,7 +185,7 @@ module Puppet::Util::ClassGen
if hash = options[:hash]
if hash.include? klassname and ! options[:overwrite]
raise Puppet::SubclassAlreadyDefined,
- "Already a generated class named %s" % klassname
+ "Already a generated class named #{klassname}"
end
hash[klassname] = klass
@@ -197,7 +197,7 @@ module Puppet::Util::ClassGen
array.find { |c| c.name == klassname } and
! options[:overwrite])
raise Puppet::SubclassAlreadyDefined,
- "Already a generated class named %s" % klassname
+ "Already a generated class named #{klassname}"
end
array << klass
diff --git a/lib/puppet/util/constant_inflector.rb b/lib/puppet/util/constant_inflector.rb
index 29d334348..20ad384d9 100644
--- a/lib/puppet/util/constant_inflector.rb
+++ b/lib/puppet/util/constant_inflector.rb
@@ -10,6 +10,6 @@ module Puppet::Util::ConstantInflector
end
def constant2file(constant)
- constant.to_s.gsub(/([a-z])([A-Z])/) { |term| $1 + "_" + $2 }.gsub("::", "/").downcase
+ constant.to_s.gsub(/([a-z])([A-Z])/) { |term| $1 + "_#{$2}" }.gsub("::", "/").downcase
end
end
diff --git a/lib/puppet/util/docs.rb b/lib/puppet/util/docs.rb
index 02374d8b7..d73550d9f 100644
--- a/lib/puppet/util/docs.rb
+++ b/lib/puppet/util/docs.rb
@@ -9,7 +9,7 @@ module Puppet::Util::Docs
# rather than just sticking them in a hash, because otherwise they're
# too difficult to do inheritance with.
def dochook(name, &block)
- method = "dochook_" + name.to_s
+ method = "dochook_#{name}"
meta_def method, &block
end
diff --git a/lib/puppet/util/errors.rb b/lib/puppet/util/errors.rb
index a44c1ca18..d78064227 100644
--- a/lib/puppet/util/errors.rb
+++ b/lib/puppet/util/errors.rb
@@ -38,7 +38,7 @@ module Puppet::Util::Errors
rescue Puppet::Error => detail
raise adderrorcontext(detail)
rescue => detail
- message = options[:message] || "%s failed with error %s: %s" % [self.class, detail.class, detail.to_s]
+ message = options[:message] || "#{self.class} failed with error #{detail.class}: #{detail}"
error = options[:type].new(message)
# We can't use self.fail here because it always expects strings,
diff --git a/lib/puppet/util/feature.rb b/lib/puppet/util/feature.rb
index d5866927a..40ecfe447 100644
--- a/lib/puppet/util/feature.rb
+++ b/lib/puppet/util/feature.rb
@@ -14,14 +14,14 @@ class Puppet::Util::Feature
def add(name, options = {})
method = name.to_s + "?"
if self.class.respond_to?(method)
- raise ArgumentError, "Feature %s is already defined" % name
+ raise ArgumentError, "Feature #{name} is already defined"
end
if block_given?
begin
result = yield
rescue Exception => detail
- warn "Failed to load feature test for %s: %s" % [name, detail]
+ warn "Failed to load feature test for #{name}: #{detail}"
result = false
end
@results[name] = result
@@ -78,7 +78,7 @@ class Puppet::Util::Feature
def load_library(lib, name)
unless lib.is_a?(String)
- raise ArgumentError, "Libraries must be passed as strings not %s" % lib.class
+ raise ArgumentError, "Libraries must be passed as strings not #{lib.class}"
end
begin
@@ -86,7 +86,7 @@ class Puppet::Util::Feature
rescue SystemExit,NoMemoryError
raise
rescue Exception
- Puppet.debug "Failed to load library '%s' for feature '%s'" % [lib, name]
+ Puppet.debug "Failed to load library '#{lib}' for feature '#{name}'"
return false
end
return true
diff --git a/lib/puppet/util/file_locking.rb b/lib/puppet/util/file_locking.rb
index f1f02be1c..ab43e2353 100644
--- a/lib/puppet/util/file_locking.rb
+++ b/lib/puppet/util/file_locking.rb
@@ -5,7 +5,7 @@ module Puppet::Util::FileLocking
# Create a shared lock for reading
def readlock(file)
- raise ArgumentError, "%s is not a file" % file unless !File.exists?(file) or File.file?(file)
+ raise ArgumentError, "#{file} is not a file" unless !File.exists?(file) or File.file?(file)
Puppet::Util.sync(file).synchronize(Sync::SH) do
File.open(file) { |f|
f.lock_shared { |lf| yield lf }
@@ -17,9 +17,9 @@ module Puppet::Util::FileLocking
# tmp file.
def writelock(file, mode = nil)
unless FileTest.directory?(File.dirname(file))
- raise Puppet::DevError, "Cannot create %s; directory %s does not exist" % [file, File.dirname(file)]
+ raise Puppet::DevError, "Cannot create #{file}; directory #{File.dirname(file)} does not exist"
end
- raise ArgumentError, "%s is not a file" % file unless !File.exists?(file) or File.file?(file)
+ raise ArgumentError, "#{file} is not a file" unless !File.exists?(file) or File.file?(file)
tmpfile = file + ".tmp"
unless mode
diff --git a/lib/puppet/util/fileparsing.rb b/lib/puppet/util/fileparsing.rb
index 7965532fd..974d908b8 100644
--- a/lib/puppet/util/fileparsing.rb
+++ b/lib/puppet/util/fileparsing.rb
@@ -44,7 +44,7 @@ module Puppet::Util::FileParsing
@fields = fields.collect do |field|
r = symbolize(field)
if INVALID_FIELDS.include?(r)
- raise ArgumentError.new("Cannot have fields named %s" % r)
+ raise ArgumentError.new("Cannot have fields named #{r}")
end
r
end
@@ -53,7 +53,7 @@ module Puppet::Util::FileParsing
def initialize(type, options = {}, &block)
@type = symbolize(type)
unless [:record, :text].include?(@type)
- raise ArgumentError, "Invalid record type %s" % @type
+ raise ArgumentError, "Invalid record type #{@type}"
end
set_options(options)
@@ -92,7 +92,7 @@ module Puppet::Util::FileParsing
if self.optional.include?(field)
self.absent
else
- raise ArgumentError, "Field '%s' is required" % field
+ raise ArgumentError, "Field '#{field}' is required"
end
else
details[field].to_s
@@ -157,7 +157,7 @@ module Puppet::Util::FileParsing
if ret = record.send(:process, line.dup)
unless ret.is_a?(Hash)
raise Puppet::DevError,
- "Process record type %s returned non-hash" % record.name
+ "Process record type #{record.name} returned non-hash"
end
else
return nil
@@ -235,7 +235,7 @@ module Puppet::Util::FileParsing
if val = parse_line(line)
val
else
- error = Puppet::Error.new("Could not parse line %s" % line.inspect)
+ error = Puppet::Error.new("Could not parse line #{line.inspect}")
error.line = count
raise error
end
@@ -250,7 +250,7 @@ module Puppet::Util::FileParsing
@record_order.each do |record|
# These are basically either text or record lines.
- method = "handle_%s_line" % record.type
+ method = "handle_#{record.type}_line"
if respond_to?(method)
if result = send(method, line, record)
if record.respond_to?(:post_parse)
@@ -260,7 +260,7 @@ module Puppet::Util::FileParsing
end
else
raise Puppet::DevError,
- "Somehow got invalid line type %s" % record.type
+ "Somehow got invalid line type #{record.type}"
end
end
@@ -323,7 +323,7 @@ module Puppet::Util::FileParsing
# Convert our parsed record into a text record.
def to_line(details)
unless record = record_type(details[:record_type])
- raise ArgumentError, "Invalid record type %s" % details[:record_type].inspect
+ raise ArgumentError, "Invalid record type #{details[:record_type].inspect}"
end
if record.respond_to?(:pre_gen)
@@ -382,7 +382,7 @@ module Puppet::Util::FileParsing
@record_order ||= []
if @record_types.include?(record.name)
- raise ArgumentError, "Line type %s is already defined" % record.name
+ raise ArgumentError, "Line type #{record.name} is already defined"
end
@record_types[record.name] = record
diff --git a/lib/puppet/util/filetype.rb b/lib/puppet/util/filetype.rb
index c2291a3ab..3df4fdee0 100755
--- a/lib/puppet/util/filetype.rb
+++ b/lib/puppet/util/filetype.rb
@@ -47,7 +47,7 @@ class Puppet::Util::FileType
if Puppet[:trace]
puts detail.backtrace
end
- raise Puppet::Error, "%s could not read %s: %s" % [self.class, @path, detail]
+ raise Puppet::Error, "#{self.class} could not read #{@path}: #{detail}"
end
end
@@ -64,7 +64,7 @@ class Puppet::Util::FileType
if Puppet[:debug]
puts detail.backtrace
end
- raise Puppet::Error, "%s could not write %s: %s" % [self.class, @path, detail]
+ raise Puppet::Error, "#{self.class} could not write #{@path}: #{detail}"
end
end
end
@@ -137,19 +137,19 @@ class Puppet::Util::FileType
# Read the file.
def read
- Puppet.info "Reading %s from RAM" % @path
+ Puppet.info "Reading #{@path} from RAM"
@@tabs[@path]
end
# Remove the file.
def remove
- Puppet.info "Removing %s from RAM" % @path
+ Puppet.info "Removing #{@path} from RAM"
@@tabs[@path] = ""
end
# Overwrite the file.
def write(text)
- Puppet.info "Writing %s to RAM" % @path
+ Puppet.info "Writing #{@path} to RAM"
@@tabs[@path] = text
end
end
@@ -164,7 +164,7 @@ class Puppet::Util::FileType
begin
@uid = Puppet::Util.uid(user)
rescue Puppet::Error => detail
- raise Puppet::Error, "Could not retrieve user %s" % user
+ raise Puppet::Error, "Could not retrieve user #{user}"
end
# XXX We have to have the user name, not the uid, because some
@@ -216,10 +216,10 @@ class Puppet::Util::FileType
begin
output = Puppet::Util.execute(%w{crontab -l}, :uid => @path)
return "" if output.include?("can't open your crontab")
- raise Puppet::Error, "User %s not authorized to use cron" % @path if output.include?("you are not authorized to use cron")
+ raise Puppet::Error, "User #{@path} not authorized to use cron" if output.include?("you are not authorized to use cron")
return output
rescue => detail
- raise Puppet::Error, "Could not read crontab for %s: %s" % [@path, detail]
+ raise Puppet::Error, "Could not read crontab for #{@path}: #{detail}"
end
end
@@ -228,7 +228,7 @@ class Puppet::Util::FileType
begin
Puppet::Util.execute(%w{crontab -r}, :uid => @path)
rescue => detail
- raise Puppet::Error, "Could not remove crontab for %s: %s" % [@path, detail]
+ raise Puppet::Error, "Could not remove crontab for #{@path}: #{detail}"
end
end
@@ -248,7 +248,7 @@ class Puppet::Util::FileType
begin
Puppet::Util.execute(["crontab", output_file.path], :uid => @path)
rescue => detail
- raise Puppet::Error, "Could not write crontab for %s: %s" % [@path, detail]
+ raise Puppet::Error, "Could not write crontab for #{@path}: #{detail}"
end
output_file.delete
end
@@ -261,11 +261,11 @@ class Puppet::Util::FileType
begin
output = Puppet::Util.execute(%w{crontab -l}, :uid => @path)
if output.include?("You are not authorized to use the cron command")
- raise Puppet::Error, "User %s not authorized to use cron" % @path
+ raise Puppet::Error, "User #{@path} not authorized to use cron"
end
return output
rescue => detail
- raise Puppet::Error, "Could not read crontab for %s: %s" % [@path, detail]
+ raise Puppet::Error, "Could not read crontab for #{@path}: #{detail}"
end
end
@@ -274,7 +274,7 @@ class Puppet::Util::FileType
begin
Puppet::Util.execute(%w{crontab -r}, :uid => @path)
rescue => detail
- raise Puppet::Error, "Could not remove crontab for %s: %s" % [@path, detail]
+ raise Puppet::Error, "Could not remove crontab for #{@path}: #{detail}"
end
end
@@ -293,7 +293,7 @@ class Puppet::Util::FileType
begin
Puppet::Util.execute(["crontab", output_file.path], :uid => @path)
rescue => detail
- raise Puppet::Error, "Could not write crontab for %s: %s" % [@path, detail]
+ raise Puppet::Error, "Could not write crontab for #{@path}: #{detail}"
ensure
output_file.delete
end
diff --git a/lib/puppet/util/inifile.rb b/lib/puppet/util/inifile.rb
index 0a957d447..38bc1c574 100644
--- a/lib/puppet/util/inifile.rb
+++ b/lib/puppet/util/inifile.rb
@@ -122,7 +122,7 @@ module Puppet::Util::IniConfig
end
elsif " \t\r\n\f".include?(l[0,1]) && section && optname
# continuation line
- section[optname] += "\n" + l.chomp
+ section[optname] += "\n#{l.chomp}"
elsif l =~ /^\[([^\]]+)\]/
# section heading
section.mark_clean unless section.nil?
diff --git a/lib/puppet/util/instance_loader.rb b/lib/puppet/util/instance_loader.rb
index bf4f9b77f..56d75b698 100755
--- a/lib/puppet/util/instance_loader.rb
+++ b/lib/puppet/util/instance_loader.rb
@@ -42,7 +42,7 @@ module Puppet::Util::InstanceLoader
# Use this method so they all get loaded
loaded_instances(type).sort { |a,b| a.to_s <=> b.to_s }.each do |name|
mod = self.loaded_instance(name)
- docs += "%s\n%s\n" % [name, "-" * name.to_s.length]
+ docs += "#{name}\n#{"-" * name.to_s.length}\n"
docs += Puppet::Util::Docs.scrub(mod.doc) + "\n\n"
end
@@ -68,7 +68,7 @@ module Puppet::Util::InstanceLoader
if instance_loader(type).load(name)
unless instances.include? name
Puppet.warning(
- "Loaded %s file for %s but %s was not defined" % [type, name, type]
+ "Loaded #{type} file for #{name} but #{type} was not defined"
)
return nil
end
diff --git a/lib/puppet/util/ldap/connection.rb b/lib/puppet/util/ldap/connection.rb
index 18d9bf5ab..4f71069ef 100644
--- a/lib/puppet/util/ldap/connection.rb
+++ b/lib/puppet/util/ldap/connection.rb
@@ -43,7 +43,7 @@ class Puppet::Util::Ldap::Connection
begin
send(param.to_s + "=", value)
rescue
- raise ArgumentError, "LDAP connections do not support %s parameters" % param
+ raise ArgumentError, "LDAP connections do not support #{param} parameters"
end
end
end
@@ -73,7 +73,7 @@ class Puppet::Util::Ldap::Connection
@connection.set_option(LDAP::LDAP_OPT_REFERRALS, LDAP::LDAP_OPT_ON)
@connection.simple_bind(user, password)
rescue => detail
- raise Puppet::Error, "Could not connect to LDAP: %s" % detail
+ raise Puppet::Error, "Could not connect to LDAP: #{detail}"
end
end
end
diff --git a/lib/puppet/util/ldap/manager.rb b/lib/puppet/util/ldap/manager.rb
index 8d444195e..cfa7cb3f7 100644
--- a/lib/puppet/util/ldap/manager.rb
+++ b/lib/puppet/util/ldap/manager.rb
@@ -80,7 +80,7 @@ class Puppet::Util::Ldap::Manager
# Calculate the dn for a given resource.
def dn(name)
- ["%s=%s" % [rdn, name], base].join(",")
+ ["#{rdn}=#{name}", base].join(",")
end
# Convert an ldap-style entry hash to a provider-style hash.
@@ -103,7 +103,7 @@ class Puppet::Util::Ldap::Manager
# Create our normal search filter.
def filter
- return "objectclass=%s" % objectclasses[0] if objectclasses.length == 1
+ return "objectclass=#{objectclasses[0]}" if objectclasses.length == 1
return "(&(objectclass=" + objectclasses.join(")(objectclass=") + "))"
end
@@ -139,7 +139,7 @@ class Puppet::Util::Ldap::Manager
if generator.source
unless value = values[generator.source]
- raise ArgumentError, "%s must be defined to generate %s" % [generator.source, generator.name]
+ raise ArgumentError, "#{generator.source} must be defined to generate #{generator.name}"
end
result = generator.generate(value)
else
@@ -216,14 +216,14 @@ class Puppet::Util::Ldap::Manager
# Update the ldap entry with the desired state.
def update(name, is, should)
if should[:ensure] == :absent
- Puppet.info "Removing %s from ldap" % dn(name)
+ Puppet.info "Removing #{dn(name)} from ldap"
delete(name)
return
end
# We're creating a new entry
if is.empty? or is[:ensure] == :absent
- Puppet.info "Creating %s in ldap" % dn(name)
+ Puppet.info "Creating #{dn(name)} in ldap"
# Remove any :absent params and :ensure, then convert the names to ldap names.
attrs = ldap_convert(should)
create(name, attrs)
diff --git a/lib/puppet/util/log.rb b/lib/puppet/util/log.rb
index 57be5f5ba..ac1992526 100644
--- a/lib/puppet/util/log.rb
+++ b/lib/puppet/util/log.rb
@@ -79,7 +79,7 @@ class Puppet::Util::Log
raise Puppet::DevError, "Logs require a level"
end
unless @levels.index(hash[:level])
- raise Puppet::DevError, "Invalid log level %s" % hash[:level]
+ raise Puppet::DevError, "Invalid log level #{hash[:level]}"
end
if @levels.index(hash[:level]) >= @loglevel
return Puppet::Util::Log.new(hash)
@@ -109,7 +109,7 @@ class Puppet::Util::Log
end
unless @levels.include?(level)
- raise Puppet::DevError, "Invalid loglevel %s" % level
+ raise Puppet::DevError, "Invalid loglevel #{level}"
end
@loglevel = @levels.index(level)
@@ -131,7 +131,7 @@ class Puppet::Util::Log
end
unless type
- raise Puppet::DevError, "Unknown destination type %s" % dest
+ raise Puppet::DevError, "Unknown destination type #{dest}"
end
begin
@@ -246,7 +246,7 @@ class Puppet::Util::Log
def level=(level)
raise ArgumentError, "Puppet::Util::Log requires a log level" unless level
@level = level.to_sym
- raise ArgumentError, "Invalid log level %s" % @level unless self.class.validlevel?(@level)
+ raise ArgumentError, "Invalid log level #{@level}" unless self.class.validlevel?(@level)
# Tag myself with my log level
tag(level)
diff --git a/lib/puppet/util/log/destinations.rb b/lib/puppet/util/log/destinations.rb
index 9fe61d484..37e6d1ae9 100644
--- a/lib/puppet/util/log/destinations.rb
+++ b/lib/puppet/util/log/destinations.rb
@@ -17,7 +17,7 @@ Puppet::Util::Log.newdesttype :syslog do
begin
facility = Syslog.const_get("LOG_#{str.upcase}")
rescue NameError
- raise Puppet::Error, "Invalid syslog facility %s" % str
+ raise Puppet::Error, "Invalid syslog facility #{str}"
end
@syslog = Syslog.open(name, options, facility)
@@ -61,7 +61,7 @@ Puppet::Util::Log.newdesttype :file do
# specified a "special" destination.
unless FileTest.exist?(File.dirname(path))
Puppet.recmkdir(File.dirname(path))
- Puppet.info "Creating log directory %s" % File.dirname(path)
+ Puppet.info "Creating log directory #{File.dirname(path)}"
end
# create the log file, if it doesn't already exist
@@ -73,7 +73,7 @@ Puppet::Util::Log.newdesttype :file do
end
def handle(msg)
- @file.puts("%s %s (%s): %s" % [msg.time, msg.source, msg.level, msg.to_s])
+ @file.puts("#{msg.time} #{msg.source} (#{msg.level}): #{msg}")
@file.flush if @autoflush
end
@@ -133,16 +133,16 @@ Puppet::Util::Log.newdesttype :console do
def handle(msg)
if msg.source == "Puppet"
- puts colorize(msg.level, "%s: %s" % [msg.level, msg.to_s])
+ puts colorize(msg.level, "#{msg.level}: #{msg}")
else
- puts colorize(msg.level, "%s: %s: %s" % [msg.level, msg.source, msg.to_s])
+ puts colorize(msg.level, "#{msg.level}: #{msg.source}: #{msg}")
end
end
end
Puppet::Util::Log.newdesttype :host do
def initialize(host)
- Puppet.info "Treating %s as a hostname" % host
+ Puppet.info "Treating #{host} as a hostname"
args = {}
if host =~ /:(\d+)/
args[:Port] = $1
@@ -164,24 +164,24 @@ Puppet::Util::Log.newdesttype :host do
unless defined?(@domain)
@domain = Facter["domain"].value
if @domain
- @hostname += "." + @domain
+ @hostname += ".#{@domain}"
end
end
if msg.source =~ /^\//
- msg.source = @hostname + ":" + msg.source
+ msg.source = @hostname + ":#{msg.source}"
elsif msg.source == "Puppet"
- msg.source = @hostname + " " + msg.source
+ msg.source = @hostname + " #{msg.source}"
else
- msg.source = @hostname + " " + msg.source
+ msg.source = @hostname + " #{msg.source}"
end
begin
- #puts "would have sent %s" % msg
+ #puts "would have sent #{msg}"
#puts "would have sent %s" %
# CGI.escape(YAML.dump(msg))
begin
tmp = CGI.escape(YAML.dump(msg))
rescue => detail
- puts "Could not dump: %s" % detail.to_s
+ puts "Could not dump: #{detail}"
return
end
# Add the hostname to the source
diff --git a/lib/puppet/util/methodhelper.rb b/lib/puppet/util/methodhelper.rb
index ecc9d537f..771d0e648 100644
--- a/lib/puppet/util/methodhelper.rb
+++ b/lib/puppet/util/methodhelper.rb
@@ -3,7 +3,7 @@ module Puppet::Util::MethodHelper
def requiredopts(*names)
names.each do |name|
if self.send(name).nil?
- devfail("%s is a required option for %s" % [name, self.class])
+ devfail("#{name} is a required option for #{self.class}")
end
end
end
diff --git a/lib/puppet/util/metric.rb b/lib/puppet/util/metric.rb
index cf8ed9ee1..e8de54cf2 100644
--- a/lib/puppet/util/metric.rb
+++ b/lib/puppet/util/metric.rb
@@ -37,14 +37,14 @@ class Puppet::Util::Metric
values.each { |value|
# the 7200 is the heartbeat -- this means that any data that isn't
# more frequently than every two hours gets thrown away
- args.push "DS:%s:GAUGE:7200:U:U" % [value[0]]
+ args.push "DS:#{value[0]}:GAUGE:7200:U:U"
}
args.push "RRA:AVERAGE:0.5:1:300"
begin
@rrd.create( Puppet[:rrdinterval].to_i, start, args)
rescue => detail
- raise "Could not create RRD file %s: %s" % [path,detail]
+ raise "Could not create RRD file #{path}: #{detail}"
end
end
@@ -62,7 +62,7 @@ class Puppet::Util::Metric
colorstack = %w{#00ff00 #ff0000 #0000ff #ffff00 #ff99ff #ff9966 #66ffff #990000 #099000 #000990 #f00990 #0f0f0f #555555 #333333 #ffffff}
{:daily => unit, :weekly => unit * 7, :monthly => unit * 30, :yearly => unit * 365}.each do |name, time|
- file = self.path.sub(/\.rrd$/, "-%s.png" % name)
+ file = self.path.sub(/\.rrd$/, "-#{name}.png")
args = [file]
args.push("--title",self.label)
@@ -75,8 +75,8 @@ class Puppet::Util::Metric
values.zip(colorstack).each { |value,color|
next if value.nil?
# this actually uses the data label
- defs.push("DEF:%s=%s:%s:AVERAGE" % [value[0],self.path,value[0]])
- lines.push("LINE2:%s%s:%s" % [value[0],color,value[1]])
+ defs.push("DEF:#{value[0]}=#{self.path}:#{value[0]}:AVERAGE")
+ lines.push("LINE2:#{value[0]}#{color}:#{value[1]}")
}
args << defs
args << lines
@@ -91,7 +91,7 @@ class Puppet::Util::Metric
#Puppet.warning "args = #{args}"
RRDtool.graph( args )
rescue => detail
- Puppet.err "Failed to graph %s: %s" % [self.name,detail]
+ Puppet.err "Failed to graph #{self.name}: #{detail}"
end
end
end
@@ -136,9 +136,9 @@ class Puppet::Util::Metric
template = temps.join(":")
begin
@rrd.update( template, [ arg ] )
- #system("rrdtool updatev %s '%s'" % [self.path, arg])
+ #system("rrdtool updatev #{self.path} '#{arg}'")
rescue => detail
- raise Puppet::Error, "Failed to update %s: %s" % [self.name,detail]
+ raise Puppet::Error, "Failed to update #{self.name}: #{detail}"
end
end
diff --git a/lib/puppet/util/nagios_maker.rb b/lib/puppet/util/nagios_maker.rb
index 339d2d1a2..e824b1de2 100644
--- a/lib/puppet/util/nagios_maker.rb
+++ b/lib/puppet/util/nagios_maker.rb
@@ -7,16 +7,16 @@ module Puppet::Util::NagiosMaker
# from the parser.
def self.create_nagios_type(name)
name = name.to_sym
- full_name = ("nagios_" + name.to_s).to_sym
+ full_name = ("nagios_#{name}").to_sym
- raise(Puppet::DevError, "No nagios type for %s" % name) unless nagtype = Nagios::Base.type(name)
+ raise(Puppet::DevError, "No nagios type for #{name}") unless nagtype = Nagios::Base.type(name)
type = Puppet::Type.newtype(full_name) {}
type.ensurable
type.newparam(nagtype.namevar, :namevar => true) do
- desc "The name parameter for Nagios type %s" % nagtype.name
+ desc "The name parameter for Nagios type #{nagtype.name}"
end
# We deduplicate the parameters because it makes sense to allow Naginator to have dupes.
diff --git a/lib/puppet/util/posix.rb b/lib/puppet/util/posix.rb
index 837c37a07..c71a846d9 100755
--- a/lib/puppet/util/posix.rb
+++ b/lib/puppet/util/posix.rb
@@ -11,7 +11,7 @@ module Puppet::Util::POSIX
if id.is_a?(Integer)
if id > Puppet[:maximum_uid].to_i
- Puppet.err "Tried to get %s field for silly id %s" % [field, id]
+ Puppet.err "Tried to get #{field} field for silly id #{id}"
return nil
end
method = methodbyid(space)
@@ -36,7 +36,7 @@ module Puppet::Util::POSIX
if id.is_a?(Integer)
integer = true
if id > Puppet[:maximum_uid].to_i
- Puppet.err "Tried to get %s field for silly id %s" % [field, id]
+ Puppet.err "Tried to get #{field} field for silly id #{id}"
return nil
end
end
diff --git a/lib/puppet/util/provider_features.rb b/lib/puppet/util/provider_features.rb
index 86f30cc8b..d106d473c 100644
--- a/lib/puppet/util/provider_features.rb
+++ b/lib/puppet/util/provider_features.rb
@@ -55,13 +55,13 @@ module Puppet::Util::ProviderFeatures
# required to determine if the feature is present.
def feature(name, docs, hash = {})
@features ||= {}
- raise(Puppet::DevError, "Feature %s is already defined" % name) if @features.include?(name)
+ raise(Puppet::DevError, "Feature #{name} is already defined") if @features.include?(name)
begin
obj = ProviderFeature.new(name, docs, hash)
@features[obj.name] = obj
rescue ArgumentError => detail
error = ArgumentError.new(
- "Could not create feature %s: %s" % [name, detail]
+ "Could not create feature #{name}: #{detail}"
)
error.set_backtrace(detail.backtrace)
raise error
@@ -76,7 +76,7 @@ module Puppet::Util::ProviderFeatures
names = @features.keys.sort { |a,b| a.to_s <=> b.to_s }
names.each do |name|
doc = @features[name].docs.gsub(/\n\s+/, " ")
- str += "- **%s**: %s\n" % [name, doc]
+ str += "- **#{name}**: #{doc}\n"
end
if providers.length > 0
diff --git a/lib/puppet/util/queue.rb b/lib/puppet/util/queue.rb
index 329b07b22..31425fbae 100644
--- a/lib/puppet/util/queue.rb
+++ b/lib/puppet/util/queue.rb
@@ -52,7 +52,7 @@ module Puppet::Util::Queue
# each registration.
def self.register_queue_type(klass, type = nil)
type ||= queue_type_from_class(klass)
- raise Puppet::Error, "Queue type %s is already registered" % type.to_s if instance_hash(:queue_clients).include?(type)
+ raise Puppet::Error, "Queue type #{type} is already registered" if instance_hash(:queue_clients).include?(type)
instance_hash(:queue_clients)[type] = klass
end
@@ -60,7 +60,7 @@ module Puppet::Util::Queue
# (meaning it hasn't been registered with this module), an exception is thrown.
def self.queue_type_to_class(type)
c = loaded_instance :queue_clients, type
- raise Puppet::Error, "Queue type %s is unknown." % type unless c
+ raise Puppet::Error, "Queue type #{type} is unknown." unless c
c
end
diff --git a/lib/puppet/util/queue/stomp.rb b/lib/puppet/util/queue/stomp.rb
index a87268b72..ffe745ff7 100644
--- a/lib/puppet/util/queue/stomp.rb
+++ b/lib/puppet/util/queue/stomp.rb
@@ -15,16 +15,16 @@ class Puppet::Util::Queue::Stomp
begin
uri = URI.parse(Puppet[:queue_source])
rescue => detail
- raise ArgumentError, "Could not create Stomp client instance - queue source %s is invalid: %s" % [Puppet[:queue_source], detail]
+ raise ArgumentError, "Could not create Stomp client instance - queue source #{Puppet[:queue_source]} is invalid: #{detail}"
end
unless uri.scheme == "stomp"
- raise ArgumentError, "Could not create Stomp client instance - queue source %s is not a Stomp URL: %s" % [Puppet[:queue_source], detail]
+ raise ArgumentError, "Could not create Stomp client instance - queue source #{Puppet[:queue_source]} is not a Stomp URL: #{detail}"
end
begin
self.stomp_client = Stomp::Client.new(uri.user, uri.password, uri.host, uri.port, true)
rescue => detail
- raise ArgumentError, "Could not create Stomp client instance with queue source %s: got internal Stomp client error %s" % [Puppet[:queue_source], detail]
+ raise ArgumentError, "Could not create Stomp client instance with queue source #{Puppet[:queue_source]}: got internal Stomp client error #{detail}"
end
end
diff --git a/lib/puppet/util/rdoc.rb b/lib/puppet/util/rdoc.rb
index 1bc48abd0..82076534d 100644
--- a/lib/puppet/util/rdoc.rb
+++ b/lib/puppet/util/rdoc.rb
@@ -35,7 +35,7 @@ module Puppet::Util::RDoc
# launch the documentation process
r.document(options)
rescue RDoc::RDocError => e
- raise Puppet::ParseError.new("RDoc error %s" % e)
+ raise Puppet::ParseError.new("RDoc error #{e}")
end
end
diff --git a/lib/puppet/util/rdoc/code_objects.rb b/lib/puppet/util/rdoc/code_objects.rb
index 995869987..9ee26f47d 100644
--- a/lib/puppet/util/rdoc/code_objects.rb
+++ b/lib/puppet/util/rdoc/code_objects.rb
@@ -169,7 +169,7 @@ module RDoc
end
def to_s
- res = self.class.name + ": " + @name + " (" + @type + ")\n"
+ res = self.class.name + ": #{@name} (#{@type})\n"
res << @comment.to_s
res
end
@@ -200,7 +200,7 @@ module RDoc
end
def to_s
- res = self.class.name + ": " + @name + "\n"
+ res = self.class.name + ": #{@name}\n"
res << @comment.to_s
res
end
@@ -225,7 +225,7 @@ module RDoc
end
def full_name
- @type + "[" + @title + "]"
+ @type + "[#{@title}]"
end
def name
@@ -233,7 +233,7 @@ module RDoc
end
def to_s
- res = @type + "[" + @title + "]\n"
+ res = @type + "[#{@title}]\n"
res << @comment.to_s
res
end
diff --git a/lib/puppet/util/rdoc/generators/puppet_generator.rb b/lib/puppet/util/rdoc/generators/puppet_generator.rb
index c32a401bd..f73b18dce 100644
--- a/lib/puppet/util/rdoc/generators/puppet_generator.rb
+++ b/lib/puppet/util/rdoc/generators/puppet_generator.rb
@@ -241,7 +241,7 @@ module Generators
res2 = []
collection['methods'].sort.each do |f|
if f.document_self
- res2 << { "href" => "../"+f.path, "name" => f.index_name.sub(/\(.*\)$/,'') }
+ res2 << { "href" => "../#{f.path}", "name" => f.index_name.sub(/\(.*\)$/,'') }
end
end
@@ -593,7 +593,7 @@ module Generators
@values["parent"] = CGI.escapeHTML(parent_class)
if parent_name
- lookup = parent_name + "::" + parent_class
+ lookup = parent_name + "::#{parent_class}"
else
lookup = parent_class
end
@@ -839,7 +839,7 @@ module Generators
def as_href(from_path)
if @options.all_one_file
- "#" + path
+ "##{path}"
else
HTMLGenerator.gen_url(from_path, path)
end
@@ -877,7 +877,7 @@ module Generators
if @options.all_one_file
aref
else
- @html_class.path + "#" + aref
+ @html_class.path + "##{aref}"
end
end
diff --git a/lib/puppet/util/rdoc/parser.rb b/lib/puppet/util/rdoc/parser.rb
index 9c86ec360..9d14ae6eb 100644
--- a/lib/puppet/util/rdoc/parser.rb
+++ b/lib/puppet/util/rdoc/parser.rb
@@ -31,7 +31,7 @@ class Parser
# main entry point
def scan
- Puppet.info "rdoc: scanning %s" % @input_file_name
+ Puppet.info "rdoc: scanning #{@input_file_name}"
if @input_file_name =~ /\.pp$/
@parser = Puppet::Parser::Parser.new(Puppet[:environment])
@parser.file = @input_file_name
@@ -81,14 +81,14 @@ class Parser
def split_module(path)
# find a module
fullpath = File.expand_path(path)
- Puppet.debug "rdoc: testing %s" % fullpath
+ Puppet.debug "rdoc: testing #{fullpath}"
if fullpath =~ /(.*)\/([^\/]+)\/(?:manifests|plugins|lib)\/.+\.(pp|rb)$/
modpath = $1
name = $2
- Puppet.debug "rdoc: module %s into %s ?" % [name, modpath]
+ Puppet.debug "rdoc: module #{name} into #{modpath} ?"
Puppet::Module.modulepath().each do |mp|
if File.identical?(modpath,mp)
- Puppet.debug "rdoc: found module %s" % name
+ Puppet.debug "rdoc: found module #{name}"
return name
end
end
@@ -127,7 +127,7 @@ class Parser
return
end
- Puppet.debug "rdoc: scanning for %s" % name
+ Puppet.debug "rdoc: scanning for #{name}"
container.module_name = name
container.global=true if name == "<site>"
@@ -185,7 +185,7 @@ class Parser
scan_for_vardef(container,stmt.children) if stmt.is_a?(Puppet::Parser::AST::ASTArray)
if stmt.is_a?(Puppet::Parser::AST::VarDef)
- Puppet.debug "rdoc: found constant: %s = %s" % [stmt.name.to_s, stmt.value.to_s]
+ Puppet.debug "rdoc: found constant: #{stmt.name} = #{stmt.value}"
container.add_constant(Constant.new(stmt.name.to_s, stmt.value.to_s, stmt.doc))
end
end
@@ -202,7 +202,7 @@ class Parser
begin
type = stmt.type.split("::").collect { |s| s.capitalize }.join("::")
title = stmt.title.is_a?(Puppet::Parser::AST::ASTArray) ? stmt.title.to_s.gsub(/\[(.*)\]/,'\1') : stmt.title.to_s
- Puppet.debug "rdoc: found resource: %s[%s]" % [type,title]
+ Puppet.debug "rdoc: found resource: #{type}[#{title}]"
param = []
stmt.params.children.each do |p|
@@ -233,7 +233,7 @@ class Parser
# create documentation for a class named +name+
def document_class(name, klass, container)
- Puppet.debug "rdoc: found new class %s" % name
+ Puppet.debug "rdoc: found new class #{name}"
container, name = get_class_or_module(container, name)
superclass = klass.parent
@@ -265,7 +265,7 @@ class Parser
# create documentation for a node
def document_node(name, node, container)
- Puppet.debug "rdoc: found new node %s" % name
+ Puppet.debug "rdoc: found new node #{name}"
superclass = node.parent
superclass = "" if superclass.nil? or superclass.empty?
@@ -290,7 +290,7 @@ class Parser
# create documentation for a define
def document_define(name, define, container)
- Puppet.debug "rdoc: found new definition %s" % name
+ Puppet.debug "rdoc: found new definition #{name}"
# find superclas if any
@stats.num_methods += 1
@@ -308,7 +308,7 @@ class Parser
when Puppet::Parser::AST::Leaf
declaration << "'#{value.value}'"
when Puppet::Parser::AST::ASTArray
- declaration << "[%s]" % value.children.collect { |v| "'#{v}'" }.join(", ")
+ declaration << "[#{value.children.collect { |v| "'#{v}'" }.join(", ")}]"
else
declaration << "#{value.to_s}"
end
@@ -322,7 +322,7 @@ class Parser
meth.comment = define.doc
container.add_method(meth)
look_for_directives_in(container, meth.comment) unless meth.comment.empty?
- meth.params = "( " + declaration + " )"
+ meth.params = "( #{declaration} )"
meth.visibility = :public
meth.document_self = true
meth.singleton = false
@@ -386,7 +386,7 @@ class Parser
container.add_fact(current_fact)
current_fact.record_location(@top_level)
comments = ""
- Puppet.debug "rdoc: found custom fact %s" % current_fact.name
+ Puppet.debug "rdoc: found custom fact #{current_fact.name}"
elsif line =~ /^[ \t]*confine[ \t]*:(.*?)[ \t]*=>[ \t]*(.*)$/
current_fact.confine = { :type => $1, :value => $2 } unless current_fact.nil?
else # unknown line type
@@ -414,7 +414,7 @@ class Parser
current_plugin.comment = comments
current_plugin.record_location(@top_level)
comments = ""
- Puppet.debug "rdoc: found new function plugins %s" % current_plugin.name
+ Puppet.debug "rdoc: found new function plugins #{current_plugin.name}"
elsif line =~ /^[ \t]*Puppet::Type.newtype[ \t]*\([ \t]*:(.*?)\)/
current_plugin = Plugin.new($1, "type")
container.add_plugin(current_plugin)
@@ -422,7 +422,7 @@ class Parser
current_plugin.comment = comments
current_plugin.record_location(@top_level)
comments = ""
- Puppet.debug "rdoc: found new type plugins %s" % current_plugin.name
+ Puppet.debug "rdoc: found new type plugins #{current_plugin.name}"
elsif line =~ /module Puppet::Parser::Functions/
# skip
else # unknown line type
diff --git a/lib/puppet/util/reference.rb b/lib/puppet/util/reference.rb
index 74d75bb3f..c5bfe4722 100644
--- a/lib/puppet/util/reference.rb
+++ b/lib/puppet/util/reference.rb
@@ -11,7 +11,7 @@ class Puppet::Util::Reference
instance_load(:reference, 'puppet/reference')
def self.footer
- "\n\n----------------\n\n*This page autogenerated on %s*\n" % Time.now
+ "\n\n----------------\n\n*This page autogenerated on #{Time.now}*\n"
end
def self.modes
@@ -29,7 +29,7 @@ class Puppet::Util::Reference
depth = 4
# Use the minimum depth
sections.each do |name|
- section = reference(name) or raise "Could not find section %s" % name
+ section = reference(name) or raise "Could not find section #{name}"
depth = section.depth if section.depth < depth
end
text = ".. contents:: :depth: 2\n\n"
@@ -69,9 +69,9 @@ class Puppet::Util::Reference
def self.markdown(name, text)
puts "Creating markdown for #{name} reference."
- dir = "/tmp/" + Puppet::PUPPETVERSION
+ dir = "/tmp/#{Puppet::PUPPETVERSION}"
FileUtils.mkdir(dir) unless File.directory?(dir)
- Puppet::Util.secure_open(dir + "/" + "#{name}.rst", "w") do |f|
+ Puppet::Util.secure_open(dir + "/#{name}.rst", "w") do |f|
f.puts text
end
pandoc = %x{which pandoc}
@@ -90,7 +90,7 @@ class Puppet::Util::Reference
exit(1)
end
- File.unlink(dir + "/" + "#{name}.rst")
+ File.unlink(dir + "/#{name}.rst")
end
def self.references
@@ -105,7 +105,7 @@ class Puppet::Util::Reference
def doc
if defined?(@doc)
- return "%s - %s" % [@name, @doc]
+ return "#{@name} - #{@doc}"
else
return @title
end
@@ -116,7 +116,7 @@ class Puppet::Util::Reference
end
def h(name, level)
- return "%s\n%s\n\n" % [name, HEADER_LEVELS[level] * name.to_s.length]
+ return "#{name}\n#{HEADER_LEVELS[level] * name.to_s.length}\n\n"
end
def initialize(name, options = {}, &block)
@@ -128,7 +128,7 @@ class Puppet::Util::Reference
meta_def(:generate, &block)
# Now handle the defaults
- @title ||= "%s Reference" % @name.to_s.capitalize
+ @title ||= "#{@name.to_s.capitalize} Reference"
@page ||= @title.gsub(/\s+/, '')
@depth ||= 2
@header ||= ""
@@ -140,12 +140,12 @@ class Puppet::Util::Reference
end
def option(name, value)
- ":%s: %s\n" % [name.to_s.capitalize, value]
+ ":#{name.to_s.capitalize}: #{value}\n"
end
def paramwrap(name, text, options = {})
options[:level] ||= 5
- #str = "%s : " % name
+ #str = "#{name} : "
str = h(name, options[:level])
if options[:namevar]
str += "- **namevar**\n\n"
@@ -171,7 +171,7 @@ class Puppet::Util::Reference
text = h(@title, 1)
text += "\n\n**This page is autogenerated; any changes will get overwritten** *(last generated on #{Time.now.to_s})*\n\n"
if withcontents
- text += ".. contents:: :depth: %s\n\n" % @depth
+ text += ".. contents:: :depth: #{@depth}\n\n"
end
text += @header
@@ -198,7 +198,7 @@ class Puppet::Util::Reference
f.puts self.to_trac
end
- puts "Writing %s reference to trac as %s" % [@name, @page]
+ puts "Writing #{@name} reference to trac as #{@page}"
cmd = %{sudo trac-admin /opt/rl/trac/puppet wiki import %s /tmp/puppetdoc.txt} % self.page
output = %x{#{cmd}}
unless $CHILD_STATUS == 0
diff --git a/lib/puppet/util/resource_template.rb b/lib/puppet/util/resource_template.rb
index 4e333571f..164d75ae3 100644
--- a/lib/puppet/util/resource_template.rb
+++ b/lib/puppet/util/resource_template.rb
@@ -44,7 +44,7 @@ class Puppet::Util::ResourceTemplate
end
def initialize(file, resource)
- raise ArgumentError, "Template %s does not exist" % file unless FileTest.exist?(file)
+ raise ArgumentError, "Template #{file} does not exist" unless FileTest.exist?(file)
@file = file
@resource = resource
end
diff --git a/lib/puppet/util/selinux.rb b/lib/puppet/util/selinux.rb
index 28752cfac..fad15d74e 100644
--- a/lib/puppet/util/selinux.rb
+++ b/lib/puppet/util/selinux.rb
@@ -125,7 +125,7 @@ module Puppet::Util::SELinux
if retval == 0
return true
else
- Puppet.warning "Failed to set SELinux context %s on %s" % [context, file]
+ Puppet.warning "Failed to set SELinux context #{context} on #{file}"
return false
end
end
diff --git a/lib/puppet/util/settings.rb b/lib/puppet/util/settings.rb
index 3a823d30b..afec53a8a 100644
--- a/lib/puppet/util/settings.rb
+++ b/lib/puppet/util/settings.rb
@@ -100,7 +100,7 @@ class Puppet::Util::Settings
elsif pval = self.value(varname)
pval
else
- raise Puppet::DevError, "Could not find value for %s" % value
+ raise Puppet::DevError, "Could not find value for #{value}"
end
end
@@ -220,7 +220,7 @@ class Puppet::Util::Settings
hash[name] = val
end
hash.sort { |a,b| a[0].to_s <=> b[0].to_s }.each do |name, val|
- puts "%s = %s" % [name, val]
+ puts "#{name} = #{val}"
end
else
val.split(/\s*,\s*/).sort.each do |v|
@@ -230,9 +230,9 @@ class Puppet::Util::Settings
puts value(val,env)
break
end
- puts "%s = %s" % [v, value(v,env)]
+ puts "#{v} = #{value(v,env)}"
else
- puts "invalid parameter: %s" % v
+ puts "invalid parameter: #{v}"
return false
end
end
@@ -382,7 +382,7 @@ class Puppet::Util::Settings
end
if type = hash[:type]
unless klass = {:setting => Setting, :file => FileSetting, :boolean => BooleanSetting}[type]
- raise ArgumentError, "Invalid setting type '%s'" % type
+ raise ArgumentError, "Invalid setting type '#{type}'"
end
hash.delete(:type)
else
@@ -394,7 +394,7 @@ class Puppet::Util::Settings
when String, Integer, Float # nothing
klass = Setting
else
- raise ArgumentError, "Invalid value '%s' for %s" % [hash[:default].inspect, hash[:name]]
+ raise ArgumentError, "Invalid value '#{hash[:default].inspect}' for #{hash[:name]}"
end
end
hash[:settings] = self
@@ -427,7 +427,7 @@ class Puppet::Util::Settings
# Reparse our config file, if necessary.
def reparse
if file and file.changed?
- Puppet.notice "Reparsing %s" % file.file
+ Puppet.notice "Reparsing #{file.file}"
parse
reuse()
end
@@ -501,7 +501,7 @@ class Puppet::Util::Settings
return
else
raise ArgumentError,
- "Attempt to assign a value to unknown configuration parameter %s" % param.inspect
+ "Attempt to assign a value to unknown configuration parameter #{param.inspect}"
end
end
if setting.respond_to?(:munge)
@@ -550,12 +550,12 @@ class Puppet::Util::Settings
hash[:name] = name
hash[:section] = section
if @config.include?(name)
- raise ArgumentError, "Parameter %s is already defined" % name
+ raise ArgumentError, "Parameter #{name} is already defined"
end
tryconfig = newsetting(hash)
if short = tryconfig.short
if other = @shortnames[short]
- raise ArgumentError, "Parameter %s is already using short name '%s'" % [other.name, short]
+ raise ArgumentError, "Parameter #{other.name} is already using short name '#{short}'"
end
@shortnames[short] = tryconfig
end
@@ -612,7 +612,7 @@ Generated on #{Time.now}.
# Add a section heading that matches our name.
if @config.include?(:run_mode)
- str += "[%s]\n" % self[:run_mode]
+ str += "[#{self[:run_mode]}]\n"
end
eachsection do |section|
persection(section) do |obj|
@@ -644,7 +644,7 @@ if @config.include?(:run_mode)
catalog = to_catalog(*sections).to_ral
rescue => detail
puts detail.backtrace if Puppet[:trace]
- Puppet.err "Could not create resources for managing Puppet's files and directories in sections %s: %s" % [sections.inspect, detail]
+ Puppet.err "Could not create resources for managing Puppet's files and directories in sections #{sections.inspect}: #{detail}"
# We need some way to get rid of any resources created during the catalog creation
# but not cleaned up.
@@ -657,7 +657,7 @@ if @config.include?(:run_mode)
if transaction.any_failed?
report = transaction.report
failures = report.logs.find_all { |log| log.level == :err }
- raise "Got %s failure(s) while initializing: %s" % [failures.length, failures.collect { |l| l.to_s }.join("; ")]
+ raise "Got #{failures.length} failure(s) while initializing: #{failures.collect { |l| l.to_s }.join("; ")}"
end
end
end
@@ -769,14 +769,14 @@ if @config.include?(:run_mode)
tmpfile = file + ".tmp"
sync = Sync.new
unless FileTest.directory?(File.dirname(tmpfile))
- raise Puppet::DevError, "Cannot create %s; directory %s does not exist" % [file, File.dirname(file)]
+ raise Puppet::DevError, "Cannot create #{file}; directory #{File.dirname(file)} does not exist"
end
sync.synchronize(Sync::EX) do
File.open(file, ::File::CREAT|::File::RDWR, 0600) do |rf|
rf.lock_exclusive do
if File.exist?(tmpfile)
- raise Puppet::Error, ".tmp file already exists for %s; Aborting locked write. Check the .tmp file and delete if appropriate" % [file]
+ raise Puppet::Error, ".tmp file already exists for #{file}; Aborting locked write. Check the .tmp file and delete if appropriate"
end
# If there's a failure, remove our tmpfile
@@ -790,7 +790,7 @@ if @config.include?(:run_mode)
begin
File.rename(tmpfile, file)
rescue => detail
- Puppet.err "Could not rename %s to %s: %s" % [file, tmpfile, detail]
+ Puppet.err "Could not rename #{file} to #{tmpfile}: #{detail}"
File.unlink(tmpfile) if FileTest.exist?(tmpfile)
end
end
@@ -803,11 +803,11 @@ if @config.include?(:run_mode)
def get_config_file_default(default)
obj = nil
unless obj = @config[default]
- raise ArgumentError, "Unknown default %s" % default
+ raise ArgumentError, "Unknown default #{default}"
end
unless obj.is_a? FileSetting
- raise ArgumentError, "Default %s is not a file" % default
+ raise ArgumentError, "Default #{default} is not a file"
end
return obj
@@ -860,14 +860,14 @@ if @config.include?(:run_mode)
param, value = $1.intern, $2
result[param] = value
unless [:owner, :mode, :group].include?(param)
- raise ArgumentError, "Invalid file option '%s'" % param
+ raise ArgumentError, "Invalid file option '#{param}'"
end
if param == :mode and value !~ /^\d+$/
raise ArgumentError, "File modes must be numbers"
end
else
- raise ArgumentError, "Could not parse '%s'" % string
+ raise ArgumentError, "Could not parse '#{string}'"
end
end
''
@@ -937,7 +937,7 @@ if @config.include?(:run_mode)
raise
end
else
- error = Puppet::Error.new("Could not match line %s" % line)
+ error = Puppet::Error.new("Could not match line #{line}")
error.file = file
error.line = line
raise error
@@ -952,9 +952,9 @@ if @config.include?(:run_mode)
begin
return File.read(file)
rescue Errno::ENOENT
- raise ArgumentError, "No such file %s" % file
+ raise ArgumentError, "No such file #{file}"
rescue Errno::EACCES
- raise ArgumentError, "Permission denied to file %s" % file
+ raise ArgumentError, "Permission denied to file #{file}"
end
end
diff --git a/lib/puppet/util/settings/boolean_setting.rb b/lib/puppet/util/settings/boolean_setting.rb
index aa365fd8e..67fce9ae3 100644
--- a/lib/puppet/util/settings/boolean_setting.rb
+++ b/lib/puppet/util/settings/boolean_setting.rb
@@ -24,7 +24,7 @@ class Puppet::Util::Settings::BooleanSetting < Puppet::Util::Settings::Setting
when true, "true"; return true
when false, "false"; return false
else
- raise ArgumentError, "Invalid value '%s' for %s" % [value.inspect, @name]
+ raise ArgumentError, "Invalid value '#{value.inspect}' for #{@name}"
end
end
end
diff --git a/lib/puppet/util/settings/file_setting.rb b/lib/puppet/util/settings/file_setting.rb
index 815bdcf52..bbb388bd6 100644
--- a/lib/puppet/util/settings/file_setting.rb
+++ b/lib/puppet/util/settings/file_setting.rb
@@ -17,7 +17,7 @@ class Puppet::Util::Settings::FileSetting < Puppet::Util::Settings::Setting
def group=(value)
unless AllowedGroups.include?(value)
identifying_fields = [desc,name,default].compact.join(': ')
- raise SettingError, "Internal error: The :group setting for %s must be 'service', not '%s'" % [identifying_fields,value]
+ raise SettingError, "Internal error: The :group setting for #{identifying_fields} must be 'service', not '#{value}'"
end
@group = value
end
@@ -30,7 +30,7 @@ class Puppet::Util::Settings::FileSetting < Puppet::Util::Settings::Setting
def owner=(value)
unless AllowedOwners.include?(value)
identifying_fields = [desc,name,default].compact.join(': ')
- raise SettingError, "Internal error: The :owner setting for %s must be either 'root' or 'service', not '%s'" % [identifying_fields,value]
+ raise SettingError, "Internal error: The :owner setting for #{identifying_fields} must be either 'root' or 'service', not '#{value}'"
end
@owner = value
end
@@ -115,7 +115,7 @@ class Puppet::Util::Settings::FileSetting < Puppet::Util::Settings::Setting
name = $1
unless @settings.include?(name)
raise ArgumentError,
- "Settings parameter '%s' is undefined" % name
+ "Settings parameter '#{name}' is undefined"
end
}
end
diff --git a/lib/puppet/util/settings/setting.rb b/lib/puppet/util/settings/setting.rb
index 489dfd01d..6f8e39209 100644
--- a/lib/puppet/util/settings/setting.rb
+++ b/lib/puppet/util/settings/setting.rb
@@ -38,14 +38,14 @@ class Puppet::Util::Settings::Setting
args.each do |param, value|
method = param.to_s + "="
unless self.respond_to? method
- raise ArgumentError, "%s does not accept %s" % [self.class, param]
+ raise ArgumentError, "#{self.class} does not accept #{param}"
end
self.send(method, value)
end
unless self.desc
- raise ArgumentError, "You must provide a description for the %s config option" % self.name
+ raise ArgumentError, "You must provide a description for the #{self.name} config option"
end
end
@@ -83,7 +83,7 @@ class Puppet::Util::Settings::Setting
# Add in a statement about the default.
if defined?(@default) and @default
- str += "# The default value is '%s'.\n" % @default
+ str += "# The default value is '#{@default}'.\n"
end
# If the value has not been overridden, then print it out commented
@@ -92,9 +92,9 @@ class Puppet::Util::Settings::Setting
value = @settings.value(self.name)
if value != @default
- line = "%s = %s" % [@name, value]
+ line = "#{@name} = #{value}"
else
- line = "# %s = %s" % [@name, @default]
+ line = "# #{@name} = #{@default}"
end
str += line + "\n"
diff --git a/lib/puppet/util/storage.rb b/lib/puppet/util/storage.rb
index 076952c1d..974d56f56 100644
--- a/lib/puppet/util/storage.rb
+++ b/lib/puppet/util/storage.rb
@@ -53,7 +53,7 @@ class Puppet::Util::Storage
return
end
unless File.file?(Puppet[:statefile])
- Puppet.warning("Checksumfile %s is not a file, ignoring" % Puppet[:statefile])
+ Puppet.warning("Checksumfile #{Puppet[:statefile]} is not a file, ignoring")
return
end
Puppet::Util.benchmark(:debug, "Loaded state") do
@@ -61,12 +61,12 @@ class Puppet::Util::Storage
begin
@@state = YAML.load(file)
rescue => detail
- Puppet.err "Checksumfile %s is corrupt (%s); replacing" % [Puppet[:statefile], detail]
+ Puppet.err "Checksumfile #{Puppet[:statefile]} is corrupt (#{detail}); replacing"
begin
File.rename(Puppet[:statefile], Puppet[:statefile] + ".bad")
rescue
raise Puppet::Error,
- "Could not rename corrupt %s; remove manually" % Puppet[:statefile]
+ "Could not rename corrupt #{Puppet[:statefile]}; remove manually"
end
end
end
@@ -77,7 +77,7 @@ class Puppet::Util::Storage
self.init
end
- #Puppet.debug "Loaded state is %s" % @@state.inspect
+ #Puppet.debug "Loaded state is #{@@state.inspect}"
end
def self.stateinspect
@@ -88,7 +88,7 @@ class Puppet::Util::Storage
Puppet.debug "Storing state"
unless FileTest.exist?(Puppet[:statefile])
- Puppet.info "Creating state file %s" % Puppet[:statefile]
+ Puppet.info "Creating state file #{Puppet[:statefile]}"
end
Puppet::Util.benchmark(:debug, "Stored state") do
diff --git a/lib/puppet/util/suidmanager.rb b/lib/puppet/util/suidmanager.rb
index 404f78890..c6b5e3c89 100644
--- a/lib/puppet/util/suidmanager.rb
+++ b/lib/puppet/util/suidmanager.rb
@@ -71,10 +71,10 @@ module Puppet::Util::SUIDManager
# Make sure the passed argument is a number.
def convert_xid(type, id)
map = {:gid => :group, :uid => :user}
- raise ArgumentError, "Invalid id type %s" % type unless map.include?(type)
+ raise ArgumentError, "Invalid id type #{type}" unless map.include?(type)
ret = Puppet::Util.send(type, id)
if ret == nil
- raise Puppet::Error, "Invalid %s: %s" % [map[type], id]
+ raise Puppet::Error, "Invalid #{map[type]}: #{id}"
end
return ret
end
diff --git a/lib/puppet/util/tagging.rb b/lib/puppet/util/tagging.rb
index 9ee90799f..51cff9520 100644
--- a/lib/puppet/util/tagging.rb
+++ b/lib/puppet/util/tagging.rb
@@ -11,7 +11,7 @@ module Puppet::Util::Tagging
qualified = []
ary.collect { |tag| tag.to_s.downcase }.each do |tag|
- fail(Puppet::ParseError, "Invalid tag %s" % tag.inspect) unless valid_tag?(tag)
+ fail(Puppet::ParseError, "Invalid tag #{tag.inspect}") unless valid_tag?(tag)
qualified << tag if tag.include?("::")
@tags << tag unless @tags.include?(tag)
end