summaryrefslogtreecommitdiffstats
path: root/lib/puppet/application/apply.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/application/apply.rb')
-rw-r--r--lib/puppet/application/apply.rb29
1 files changed, 8 insertions, 21 deletions
diff --git a/lib/puppet/application/apply.rb b/lib/puppet/application/apply.rb
index 59a95d35a..e5b4bb5b7 100644
--- a/lib/puppet/application/apply.rb
+++ b/lib/puppet/application/apply.rb
@@ -85,12 +85,12 @@ class Puppet::Application::Apply < Puppet::Application
end
# Collect our facts.
- unless facts = Puppet::Node::Facts.find(Puppet[:certname])
+ unless facts = Puppet::Node::Facts.indirection.find(Puppet[:certname])
raise "Could not find facts for #{Puppet[:certname]}"
end
# Find our Node
- unless node = Puppet::Node.find(Puppet[:certname])
+ unless node = Puppet::Node.indirection.find(Puppet[:certname])
raise "Could not find node #{Puppet[:certname]}"
end
@@ -112,7 +112,7 @@ class Puppet::Application::Apply < Puppet::Application
begin
# Compile our catalog
starttime = Time.now
- catalog = Puppet::Resource::Catalog.find(node.name, :use_node => node)
+ catalog = Puppet::Resource::Catalog.indirection.find(node.name, :use_node => node)
# Translate it to a RAL catalog
catalog = catalog.to_ral
@@ -123,25 +123,9 @@ class Puppet::Application::Apply < Puppet::Application
require 'puppet/configurer'
configurer = Puppet::Configurer.new
- configurer.execute_prerun_command
+ report = configurer.run(:skip_plugin_download => true, :catalog => catalog)
- # And apply it
- if Puppet[:report]
- report = configurer.initialize_report
- Puppet::Util::Log.newdestination(report)
- end
- transaction = catalog.apply
-
- configurer.execute_postrun_command
-
- if Puppet[:report]
- Puppet::Util::Log.close(report)
- configurer.send_report(report, transaction)
- else
- transaction.generate_report
- end
-
- exit( Puppet[:noop] ? 0 : options[:detailed_exitcodes] ? transaction.report.exit_status : 0 )
+ exit( Puppet[:noop] ? 0 : options[:detailed_exitcodes] ? report.exit_status : 0 )
rescue => detail
puts detail.backtrace if Puppet[:trace]
$stderr.puts detail.message
@@ -164,6 +148,9 @@ class Puppet::Application::Apply < Puppet::Application
exit(1)
end
+ # we want the last report to be persisted locally
+ Puppet::Transaction::Report.indirection.cache_class = :yaml
+
if options[:debug]
Puppet::Util::Log.level = :debug
elsif options[:verbose]