summaryrefslogtreecommitdiffstats
path: root/lib/puppet/application
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2010-08-27 12:33:15 -0700
committerJesse Wolfe <jes5199@gmail.com>2010-08-27 12:33:15 -0700
commitfb9034731ddae41f1009745eb8eb1ea53aa05cfb (patch)
tree5cb8296af8859f59b9a20995105af77a9cdb2821 /lib/puppet/application
parent16f701edd89a320ad73b5468d883dfb017fe6e96 (diff)
parent8be1929043f4560bb17a4b06293b3f9a4efcfdbf (diff)
downloadpuppet-fb9034731ddae41f1009745eb8eb1ea53aa05cfb.tar.gz
puppet-fb9034731ddae41f1009745eb8eb1ea53aa05cfb.tar.xz
puppet-fb9034731ddae41f1009745eb8eb1ea53aa05cfb.zip
Merge commit '2.6.1rc3' into next
Diffstat (limited to 'lib/puppet/application')
-rw-r--r--lib/puppet/application/apply.rb20
-rw-r--r--lib/puppet/application/queue.rb1
2 files changed, 15 insertions, 6 deletions
diff --git a/lib/puppet/application/apply.rb b/lib/puppet/application/apply.rb
index bb4186dbd..59a95d35a 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.
@@ -123,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
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