summaryrefslogtreecommitdiffstats
path: root/lib/puppet/application
diff options
context:
space:
mode:
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