summaryrefslogtreecommitdiffstats
path: root/lib/puppet/application/apply.rb
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2010-08-27 12:49:54 -0700
committerJesse Wolfe <jes5199@gmail.com>2010-08-27 12:50:26 -0700
commit21afb51a1b84116b2a906a6959ae588f45135104 (patch)
tree48fa0438d0a50202194956344d0cf1f10b17b818 /lib/puppet/application/apply.rb
parent1f3070c4bc77b38e3dd6170cf6a58bee7ec337ac (diff)
parent8be1929043f4560bb17a4b06293b3f9a4efcfdbf (diff)
downloadpuppet-21afb51a1b84116b2a906a6959ae588f45135104.tar.gz
puppet-21afb51a1b84116b2a906a6959ae588f45135104.tar.xz
puppet-21afb51a1b84116b2a906a6959ae588f45135104.zip
Merge commit '2.6.1rc3'
This synchronizes the 2.7 master branch with 2.6.1RC3 The 2.7 next branch has now diverged from master for the first time, as if contains code that has not reached "release quality" status.
Diffstat (limited to 'lib/puppet/application/apply.rb')
-rw-r--r--lib/puppet/application/apply.rb20
1 files changed, 14 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