Module: Puppet::Configurer::PluginHandler
- Included in:
- Puppet::Configurer
- Defined in:
- lib/vendor/puppet/configurer/plugin_handler.rb
Overview
Break out the code related to plugins. This module is just included into the agent, but having it here makes it easier to test.
Instance Method Summary collapse
-
#download_plugins ⇒ Object
Retrieve facts from the central server.
- #download_plugins? ⇒ Boolean
- #load_plugin(file) ⇒ Object
Instance Method Details
#download_plugins ⇒ Object
Retrieve facts from the central server.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/vendor/puppet/configurer/plugin_handler.rb', line 10 def download_plugins return nil unless download_plugins? plugin_downloader = Puppet::Configurer::Downloader.new( "plugin", Puppet[:plugindest], Puppet[:pluginsource], Puppet[:pluginsignore] ) plugin_downloader.evaluate.each { |file| load_plugin(file) } end |
#download_plugins? ⇒ Boolean
5 6 7 |
# File 'lib/vendor/puppet/configurer/plugin_handler.rb', line 5 def download_plugins? Puppet[:pluginsync] end |
#load_plugin(file) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/vendor/puppet/configurer/plugin_handler.rb', line 22 def load_plugin(file) return unless FileTest.exist?(file) return if FileTest.directory?(file) begin if file =~ /.rb$/ Puppet.info "Loading downloaded plugin #{file}" load file else Puppet.debug "Skipping downloaded plugin #{file}" end rescue Exception => detail Puppet.err "Could not load downloaded file #{file}: #{detail}" end end |