class Puppet::Provider::Package

Public Class Methods

prefetch(packages) click to toggle source

Prefetch our package list, yo.

   # File lib/puppet/provider/package.rb
 6 def self.prefetch(packages)
 7   instances.each do |prov|
 8     pkg = packages[prov.name]
 9     if pkg
10       pkg.provider = prov
11     end
12   end
13 end

Public Instance Methods

flush() click to toggle source

Clear out the cached values.

   # File lib/puppet/provider/package.rb
16 def flush
17   @property_hash.clear
18 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
46 def join_options(options)
47   return unless options
48 
49   options.collect do |val|
50     case val
51       when Hash
52         val.keys.sort.collect do |k|
53           "#{k}=#{val[k]}"
54         end
55       else
56         val
57     end
58   end.flatten
59 end
properties() click to toggle source

Look up the current status.

   # File lib/puppet/provider/package.rb
21 def properties
22   if @property_hash.empty?
23     # For providers that support purging, default to purged; otherwise default to absent
24     # Purged is the "most uninstalled" a package can be, so a purged package will be in-sync with
25     # either `ensure => absent` or `ensure => purged`; an absent package will be out of sync with `ensure => purged`.
26     default_status = self.class.feature?(:purgeable) ? :purged : :absent
27     @property_hash = query || { :ensure => ( default_status )}
28     @property_hash[:ensure] = default_status if @property_hash.empty?
29   end
30   @property_hash.dup
31 end
validate_source(value) click to toggle source
   # File lib/puppet/provider/package.rb
33 def validate_source(value)
34   true
35 end