Class: Puppet::Provider::A2mod
- Inherits:
-
Puppet::Provider
- Object
- Puppet::Provider
- Puppet::Provider::A2mod
- Defined in:
- lib/puppet/provider/a2mod.rb
Overview
a2mod.rb
Class Method Summary collapse
-
.prefetch(mods) ⇒ Object
Fetches the mod provider.
Instance Method Summary collapse
-
#exists? ⇒ Boolean
Return’s if the ensure property is absent or not.
-
#flush ⇒ Object
Clear’s the property_hash.
-
#properties ⇒ Object
Returns a copy of the property_hash.
-
#query ⇒ Object
Returns the properties of the given mod if it exists.
Class Method Details
.prefetch(mods) ⇒ Object
Fetches the mod provider
6 7 8 9 10 11 12 13 |
# File 'lib/puppet/provider/a2mod.rb', line 6 def self.prefetch(mods) instances.each do |prov| mod = mods[prov.name] if mod mod.provider = prov end end end |
Instance Method Details
#exists? ⇒ Boolean
Return’s if the ensure property is absent or not
40 41 42 |
# File 'lib/puppet/provider/a2mod.rb', line 40 def exists? properties[:ensure] != :absent end |
#flush ⇒ Object
Clear’s the property_hash
16 17 18 |
# File 'lib/puppet/provider/a2mod.rb', line 16 def flush @property_hash.clear end |
#properties ⇒ Object
Returns a copy of the property_hash
21 22 23 24 25 26 27 |
# File 'lib/puppet/provider/a2mod.rb', line 21 def properties if @property_hash.empty? @property_hash = query || { ensure: :absent } @property_hash[:ensure] = :absent if @property_hash.empty? end @property_hash.dup end |
#query ⇒ Object
Returns the properties of the given mod if it exists.
30 31 32 33 34 35 36 37 |
# File 'lib/puppet/provider/a2mod.rb', line 30 def query self.class.instances.each do |mod| if mod.name == name || mod.name.downcase == name return mod.properties end end nil end |