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 |
# File 'lib/puppet/provider/a2mod.rb', line 6 def self.prefetch(mods) instances.each do |prov| mod = mods[prov.name] mod.provider = prov if mod end end |
Instance Method Details
#exists? ⇒ Boolean
Return’s if the ensure property is absent or not
36 37 38 |
# File 'lib/puppet/provider/a2mod.rb', line 36 def exists? properties[:ensure] != :absent end |
#flush ⇒ Object
Clear’s the property_hash
14 15 16 |
# File 'lib/puppet/provider/a2mod.rb', line 14 def flush @property_hash.clear end |
#properties ⇒ Object
Returns a copy of the property_hash
19 20 21 22 23 24 25 |
# File 'lib/puppet/provider/a2mod.rb', line 19 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.
28 29 30 31 32 33 |
# File 'lib/puppet/provider/a2mod.rb', line 28 def query self.class.instances.each do |mod| return mod.properties if mod.name == name || mod.name.downcase == name end nil end |