class Puppet::Provider::Package
Public Class Methods
prefetch(packages)
click to toggle source
Prefetch our package list, yo.
# File lib/puppet/provider/package.rb 5 def self.prefetch(packages) 6 instances.each do |prov| 7 pkg = packages[prov.name] 8 if pkg 9 pkg.provider = prov 10 end 11 end 12 end
Public Instance Methods
flush()
click to toggle source
Clear out the cached values.
# File lib/puppet/provider/package.rb 15 def flush 16 @property_hash.clear 17 end
join_options(options)
click to toggle source
Turns a array of options into flags to be passed to a command. The options can be passed as a string or hash. Note that passing a hash should only be used in case –foo=bar must be passed, which can be accomplished with:
install_options => [ { '--foo' => 'bar' } ]
Regular flags like '–foo' must be passed as a string. @param options [Array] @return Concatenated list of options @api private
# File lib/puppet/provider/package.rb 45 def join_options(options) 46 return unless options 47 48 options.collect do |val| 49 case val 50 when Hash 51 val.keys.sort.collect do |k| 52 "#{k}=#{val[k]}" 53 end 54 else 55 val 56 end 57 end.flatten 58 end
properties()
click to toggle source
Look up the current status.
# File lib/puppet/provider/package.rb 20 def properties 21 if @property_hash.empty? 22 # For providers that support purging, default to purged; otherwise default to absent 23 # Purged is the "most uninstalled" a package can be, so a purged package will be in-sync with 24 # either `ensure => absent` or `ensure => purged`; an absent package will be out of sync with `ensure => purged`. 25 default_status = self.class.feature?(:purgeable) ? :purged : :absent 26 @property_hash = query || { :ensure => ( default_status )} 27 @property_hash[:ensure] = default_status if @property_hash.empty? 28 end 29 @property_hash.dup 30 end
validate_source(value)
click to toggle source
# File lib/puppet/provider/package.rb 32 def validate_source(value) 33 true 34 end