From 3df0490c9dbc59e27869e09864177536400a5ae3 Mon Sep 17 00:00:00 2001 From: Matt Robinson Date: Thu, 5 Aug 2010 11:09:25 -0700 Subject: [#4298] Puppet apply prints an error if the file to apply doesn't exist Also warns you it's skipping files if you pass it more than one file to apply. Reviewed-by: Nick Lewis Signed-off-by: Matt Robinson --- lib/puppet/application/apply.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/puppet/application') diff --git a/lib/puppet/application/apply.rb b/lib/puppet/application/apply.rb index bb4186dbd..152b75442 100644 --- a/lib/puppet/application/apply.rb +++ b/lib/puppet/application/apply.rb @@ -78,7 +78,10 @@ class Puppet::Application::Apply < Puppet::Application if options[:code] or command_line.args.length == 0 Puppet[:code] = options[:code] || STDIN.read else - Puppet[:manifest] = command_line.args.shift + manifest = command_line.args.shift + raise "Could not find file #{manifest}" unless File.exist?(manifest) + Puppet.warning("Only one file can be applied per run. Skipping #{command_line.args.join(', ')}") if command_line.args.size > 0 + Puppet[:manifest] = manifest end # Collect our facts. -- cgit From 4c280796f71fd2153ae05dfec227fb4123152088 Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Tue, 17 Aug 2010 16:19:38 -0700 Subject: [#4555] puppet queue tries to call code it hasn't required puppet queue was trying to call .subscribe on Puppet::Resource::Catalog::Queue, but that object had not been loaded into the ruby interpreter. This bug was partially masked by ruby's confusing constant resolution, which was incorrectly returning the Puppet::Application::Queue class instead of throwing a NameError --- lib/puppet/application/queue.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/puppet/application') diff --git a/lib/puppet/application/queue.rb b/lib/puppet/application/queue.rb index 6df825dd1..6c90ca0a1 100644 --- a/lib/puppet/application/queue.rb +++ b/lib/puppet/application/queue.rb @@ -38,6 +38,7 @@ class Puppet::Application::Queue < Puppet::Application option("--verbose","-v") def main + require 'lib/puppet/indirector/catalog/queue' # provides Puppet::Indirector::Queue.subscribe 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 -- cgit From 302d657658db068c0c593545e92923659608c5a3 Mon Sep 17 00:00:00 2001 From: Markus Roberts Date: Sat, 21 Aug 2010 14:35:05 -0700 Subject: Fix for #4501 -- reports not generated in standalone The refactors for 2.6.x stopped "puppet apply" from saving reports; this fix adds report saving back to puppet apply but leaves a number of related issues (code path consolidation, report contents, etc.) unresolved for future patches in the 2.6.x series or more significant refactoring in 2.7.x. --- lib/puppet/application/apply.rb | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'lib/puppet/application') diff --git a/lib/puppet/application/apply.rb b/lib/puppet/application/apply.rb index 152b75442..59a95d35a 100644 --- a/lib/puppet/application/apply.rb +++ b/lib/puppet/application/apply.rb @@ -126,17 +126,22 @@ class Puppet::Application::Apply < Puppet::Application configurer.execute_prerun_command # And apply it + if Puppet[:report] + report = configurer.initialize_report + Puppet::Util::Log.newdestination(report) + end transaction = catalog.apply configurer.execute_postrun_command - status = 0 - if not Puppet[:noop] and options[:detailed_exitcodes] - transaction.generate_report - exit(transaction.report.exit_status) + if Puppet[:report] + Puppet::Util::Log.close(report) + configurer.send_report(report, transaction) else - exit(0) + transaction.generate_report end + + exit( Puppet[:noop] ? 0 : options[:detailed_exitcodes] ? transaction.report.exit_status : 0 ) rescue => detail puts detail.backtrace if Puppet[:trace] $stderr.puts detail.message -- cgit