Class: OS::Puppet::Fencing::Classifier
- Inherits:
-
Object
- Object
- OS::Puppet::Fencing::Classifier
- Defined in:
- lib/fencing/classifier.rb
Instance Method Summary collapse
- #assert_blocked(host_name, blocker) ⇒ Object
-
#initialize(config, facter_adapter) ⇒ Classifier
constructor
A new instance of Classifier.
- #resolve_node(host_name) ⇒ Object
Constructor Details
#initialize(config, facter_adapter) ⇒ Classifier
Returns a new instance of Classifier.
9 10 11 12 |
# File 'lib/fencing/classifier.rb', line 9 def initialize(config, facter_adapter) @config = config @facter = facter_adapter end |
Instance Method Details
#assert_blocked(host_name, blocker) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/fencing/classifier.rb', line 21 def assert_blocked(host_name, blocker) if !blocker Log.log("No blocker exists - returning") return end allowed_host = blocker.blocking_host_name return if !allowed_host Log.log("blocker not blocking #{allowed_host}") return if host_name.start_with?(allowed_host) fact_name = blocker.fact fact_value = @facter.lookup(allowed_host, fact_name) Log.log("Fact #{fact_name} on node #{allowed_host} has value #{fact_value}: expecting #{blocker.expected_value}") raise "cannot release #{host_name}" unless fact_value == blocker.expected_value Log.log("Fine - releasing node definition for #{host_name}") end |