Class: Puppet::Configurer::Downloader
- Defined in:
- lib/puppet/configurer/downloader.rb
Instance Attribute Summary collapse
-
#ignore ⇒ Object
readonly
Returns the value of attribute ignore.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
- #catalog ⇒ Object
-
#evaluate ⇒ Object
Evaluate our download, returning the list of changed values.
- #file ⇒ Object
-
#initialize(name, path, source, ignore = nil, environment = nil, source_permissions = :ignore) ⇒ Downloader
constructor
A new instance of Downloader.
Constructor Details
#initialize(name, path, source, ignore = nil, environment = nil, source_permissions = :ignore) ⇒ Downloader
Returns a new instance of Downloader.
25 26 27 |
# File 'lib/puppet/configurer/downloader.rb', line 25 def initialize(name, path, source, ignore = nil, environment = nil, = :ignore) @name, @path, @source, @ignore, @environment, @source_permissions = name, path, source, ignore, environment, end |
Instance Attribute Details
#ignore ⇒ Object (readonly)
Returns the value of attribute ignore.
5 6 7 |
# File 'lib/puppet/configurer/downloader.rb', line 5 def ignore @ignore end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/puppet/configurer/downloader.rb', line 5 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
5 6 7 |
# File 'lib/puppet/configurer/downloader.rb', line 5 def path @path end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
5 6 7 |
# File 'lib/puppet/configurer/downloader.rb', line 5 def source @source end |
Instance Method Details
#catalog ⇒ Object
29 30 31 32 33 34 |
# File 'lib/puppet/configurer/downloader.rb', line 29 def catalog catalog = Puppet::Resource::Catalog.new("PluginSync", @environment) catalog.host_config = false catalog.add_resource(file) catalog end |
#evaluate ⇒ Object
Evaluate our download, returning the list of changed values.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/puppet/configurer/downloader.rb', line 8 def evaluate Puppet.info _("Retrieving %{name}") % { name: name } files = [] begin catalog.apply do |trans| trans.changed?.each do |resource| yield resource if block_given? files << resource[:path] end end rescue Puppet::Error => detail Puppet.log_exception(detail, _("Could not retrieve %{name}: %{detail}") % { name: name, detail: detail }) end files end |