summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPaul Berry <paul@puppetlabs.com>2010-11-23 11:47:36 -0800
committerNick Lewis <nick@puppetlabs.com>2010-12-16 15:22:16 -0800
commit093c45f7bffb91b869daaf5c6f97383a90e70a18 (patch)
tree63966f42451816dfb890fd5a7608703a3b0e623d /lib
parent367633b7e67ff127c0fc8a12c2268941572a7837 (diff)
downloadpuppet-093c45f7bffb91b869daaf5c6f97383a90e70a18.tar.gz
puppet-093c45f7bffb91b869daaf5c6f97383a90e70a18.tar.xz
puppet-093c45f7bffb91b869daaf5c6f97383a90e70a18.zip
(#5375) Rework puppet apply to use configurer.run
Puppet apply used to contain code that duplicated the functionality of configurer.run. Refactored to share code. Paired-with: Jesse Wolfe <jesse@puppetlabs.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/application/apply.rb20
-rw-r--r--lib/puppet/configurer.rb8
2 files changed, 6 insertions, 22 deletions
diff --git a/lib/puppet/application/apply.rb b/lib/puppet/application/apply.rb
index 59a95d35a..33a70ce8a 100644
--- a/lib/puppet/application/apply.rb
+++ b/lib/puppet/application/apply.rb
@@ -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
diff --git a/lib/puppet/configurer.rb b/lib/puppet/configurer.rb
index 31d31c2d2..2687f5fbd 100644
--- a/lib/puppet/configurer.rb
+++ b/lib/puppet/configurer.rb
@@ -77,12 +77,12 @@ class Puppet::Configurer
end
# Prepare for catalog retrieval. Downloads everything necessary, etc.
- def prepare
+ def prepare(options)
dostorage
- download_plugins
+ download_plugins unless options[:skip_plugin_download]
- download_fact_plugins
+ download_fact_plugins unless options[:skip_plugin_download]
execute_prerun_command
end
@@ -126,7 +126,7 @@ class Puppet::Configurer
# which accepts :tags and :ignoreschedules.
def run(options = {})
begin
- prepare
+ prepare(options)
rescue SystemExit,NoMemoryError
raise
rescue Exception => detail