summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Pittman <daniel@rimspace.net>2008-07-29 15:52:23 +1000
committerJames Turnbull <james@lovedthanlost.net>2008-08-01 08:51:58 +1000
commit13069eca1a3e2b08f5201462021d83e2e0a81018 (patch)
tree37e80c752da45adab302f2098ea3dbf7faf16ae2
parent469c5fea8fccf9427217ce0c84195184117c2341 (diff)
downloadpuppet-13069eca1a3e2b08f5201462021d83e2e0a81018.tar.gz
puppet-13069eca1a3e2b08f5201462021d83e2e0a81018.tar.xz
puppet-13069eca1a3e2b08f5201462021d83e2e0a81018.zip
Ensure that we consistently use either string #{} interpolation or String.%
interpolation, not both, to avoid issues where a #{} interpolated value contains a % character. Signed-off-by: Daniel Pittman <daniel@rimspace.net>
-rw-r--r--lib/puppet/indirector/facts/facter.rb5
-rw-r--r--lib/puppet/metatype/metaparams.rb3
-rw-r--r--lib/puppet/network/client/master.rb7
-rw-r--r--lib/puppet/reports/rrdgraph.rb5
-rw-r--r--lib/puppet/transportable.rb17
-rw-r--r--lib/puppet/util/ldap/manager.rb2
6 files changed, 23 insertions, 16 deletions
diff --git a/lib/puppet/indirector/facts/facter.rb b/lib/puppet/indirector/facts/facter.rb
index 465d90c13..6ed89dac1 100644
--- a/lib/puppet/indirector/facts/facter.rb
+++ b/lib/puppet/indirector/facts/facter.rb
@@ -12,12 +12,13 @@ class Puppet::Node::Facts::Facter < Puppet::Indirector::Code
Dir.entries(dir).find_all { |e| e =~ /\.rb$/ }.each do |file|
fqfile = ::File.join(dir, file)
begin
- Puppet.info "Loading #{type} %s" % ::File.basename(file.sub(".rb",''))
+ Puppet.info "Loading %s %s" %
+ [type, ::File.basename(file.sub(".rb",''))]
Timeout::timeout(self.timeout) do
load fqfile
end
rescue => detail
- Puppet.warning "Could not load #{type} %s: %s" % [fqfile, detail]
+ Puppet.warning "Could not load %s %s: %s" % [type, fqfile, detail]
end
end
end
diff --git a/lib/puppet/metatype/metaparams.rb b/lib/puppet/metatype/metaparams.rb
index edd594114..df96733c2 100644
--- a/lib/puppet/metatype/metaparams.rb
+++ b/lib/puppet/metatype/metaparams.rb
@@ -258,7 +258,8 @@ class Puppet::Type
@value.each do |value|
unless @resource.catalog.resource(*value)
description = self.class.direction == :in ? "dependency" : "dependent"
- fail Puppet::Error, "Could not find #{description} %s[%s] for %s" % [value[0].to_s.capitalize, value[1], resource.ref]
+ fail Puppet::Error, "Could not find %s %s[%s] for %s" %
+ [description, value[0].to_s.capitalize, value[1], resource.ref]
end
end
end
diff --git a/lib/puppet/network/client/master.rb b/lib/puppet/network/client/master.rb
index 2da6cf890..6f8e2770f 100644
--- a/lib/puppet/network/client/master.rb
+++ b/lib/puppet/network/client/master.rb
@@ -338,7 +338,7 @@ class Puppet::Network::Client::Master < Puppet::Network::Client
if Puppet[:debug]
puts detail.backtrace
end
- Puppet.err "Could not retrieve #{args[:name]}s: %s" % detail
+ Puppet.err "Could not retrieve %ss: %s" % [args[:name], detail]
end
# Now clean up after ourselves
@@ -389,12 +389,13 @@ class Puppet::Network::Client::Master < Puppet::Network::Client
Dir.entries(dir).find_all { |e| e =~ /\.rb$/ }.each do |file|
fqfile = ::File.join(dir, file)
begin
- Puppet.info "Loading #{type} %s" % ::File.basename(file.sub(".rb",''))
+ Puppet.info "Loading %s %s" %
+ [type, ::File.basename(file.sub(".rb",''))]
Timeout::timeout(self.timeout) do
load fqfile
end
rescue => detail
- Puppet.warning "Could not load #{type} %s: %s" % [fqfile, detail]
+ Puppet.warning "Could not load %s %s: %s" % [type, fqfile, detail]
end
end
end
diff --git a/lib/puppet/reports/rrdgraph.rb b/lib/puppet/reports/rrdgraph.rb
index 03d8a5bdd..5889750dd 100644
--- a/lib/puppet/reports/rrdgraph.rb
+++ b/lib/puppet/reports/rrdgraph.rb
@@ -90,8 +90,9 @@ Puppet::Reports.register_report(:rrdgraph) do
of.puts "<html><head><title>Report graphs for %s</title></head><body>" %
host
files.each do |file|
- of.puts "<a href='#{File.basename(file)}'>%s</a><br/>" %
- File.basename(file).sub(".html",'').capitalize
+ of.puts "<a href='%s'>%s</a><br/>" %
+ [File.basename(file),
+ File.basename(file).sub(".html",'').capitalize]
end
of.puts "</body></html>"
end
diff --git a/lib/puppet/transportable.rb b/lib/puppet/transportable.rb
index 3ad084b3b..d203b5928 100644
--- a/lib/puppet/transportable.rb
+++ b/lib/puppet/transportable.rb
@@ -65,13 +65,16 @@ module Puppet
end
def to_manifest
- "#{self.type.to_s} { \'#{self.name}\':\n%s\n}" % @params.collect { |p, v|
- if v.is_a? Array
- " #{p} => [\'#{v.join("','")}\']"
- else
- " #{p} => \'#{v}\'"
- end
- }.join(",\n")
+ "%s { '%s':\n%s\n}" %
+ [self.type.to_s, self.name,
+ @params.collect { |p, v|
+ if v.is_a? Array
+ " #{p} => [\'#{v.join("','")}\']"
+ else
+ " #{p} => \'#{v}\'"
+ end
+ }.join(",\n")
+ ]
end
def to_yaml_properties
diff --git a/lib/puppet/util/ldap/manager.rb b/lib/puppet/util/ldap/manager.rb
index 9761fc753..8d444195e 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)
- ["#{rdn.to_s}=%s" % name, base].join(",")
+ ["%s=%s" % [rdn, name], base].join(",")
end
# Convert an ldap-style entry hash to a provider-style hash.