diff options
Diffstat (limited to 'lib/puppet/application')
-rw-r--r-- | lib/puppet/application/agent.rb | 6 | ||||
-rw-r--r-- | lib/puppet/application/apply.rb | 8 | ||||
-rw-r--r-- | lib/puppet/application/cert.rb | 2 | ||||
-rw-r--r-- | lib/puppet/application/describe.rb | 6 | ||||
-rw-r--r-- | lib/puppet/application/doc.rb | 20 | ||||
-rw-r--r-- | lib/puppet/application/filebucket.rb | 6 | ||||
-rw-r--r-- | lib/puppet/application/kick.rb | 22 | ||||
-rw-r--r-- | lib/puppet/application/master.rb | 6 | ||||
-rw-r--r-- | lib/puppet/application/queue.rb | 6 | ||||
-rw-r--r-- | lib/puppet/application/resource.rb | 4 |
10 files changed, 43 insertions, 43 deletions
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) |