Class: Puppet::Provider::Firewall
- Inherits:
-
Puppet::Provider
- Object
- Puppet::Provider
- Puppet::Provider::Firewall
- Defined in:
- lib/puppet/provider/firewall.rb
Overview
firewall.rb
Class Method Summary collapse
-
.prefetch(resources) ⇒ Object
Prefetch our rule list.
Instance Method Summary collapse
-
#properties ⇒ Object
Look up the current status.
-
#query ⇒ Object
Pull the current state of the list from the full list.
Class Method Details
.prefetch(resources) ⇒ Object
Prefetch our rule list. This is ran once every time before any other action (besides initialization of each object).
9 10 11 12 13 14 15 16 17 |
# File 'lib/puppet/provider/firewall.rb', line 9 def self.prefetch(resources) debug('[prefetch(resources)]') instances.each do |prov| resource = resources[prov.name] || resources[prov.name.downcase] if resource resource.provider = prov end end end |
Instance Method Details
#properties ⇒ Object
Look up the current status. This allows us to conventiently look up existing status with properties.
21 22 23 24 25 26 27 |
# File 'lib/puppet/provider/firewall.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
Pull the current state of the list from the full list. We’re getting some double entendre here.…
31 32 33 34 35 36 37 38 |
# File 'lib/puppet/provider/firewall.rb', line 31 def query self.class.instances.each do |instance| if instance.name == name || instance.name.downcase == name return instance.properties end end nil end |