Class: Loom::Facts::Provider
- Inherits:
-
Object
- Object
- Loom::Facts::Provider
- Defined in:
- lib/loom/facts/provider.rb
Direct Known Subclasses
FactFileProvider, LoomExt::CoreFacts::FacterProvider, LoomExt::CoreFacts::SystemInfoProvider
Instance Attribute Summary collapse
-
#fact_map ⇒ Object
readonly
TODO: add documentation re: use of namespace in fact_set.rb.
-
#namespace ⇒ Object
readonly
TODO: add documentation re: use of namespace in fact_set.rb.
Class Method Summary collapse
- .create_fact_providers(host_spec, shell, loom_config) ⇒ Object
- .disable_for_host(host_spec, klass) ⇒ Object
- .disabled_for_host?(host_spec, klass) ⇒ Boolean
- .register_factory(klass, &block) ⇒ Object
Instance Method Summary collapse
-
#collect_facts ⇒ Object
Should return a Hash of fact_name => fact_value entries.
- #disable(host_spec) ⇒ Object
Instance Attribute Details
#fact_map ⇒ Object (readonly)
TODO: add documentation re: use of namespace in fact_set.rb
5 6 7 |
# File 'lib/loom/facts/provider.rb', line 5 def fact_map @fact_map end |
#namespace ⇒ Object (readonly)
TODO: add documentation re: use of namespace in fact_set.rb
5 6 7 |
# File 'lib/loom/facts/provider.rb', line 5 def namespace @namespace end |
Class Method Details
.create_fact_providers(host_spec, shell, loom_config) ⇒ Object
31 32 33 34 35 |
# File 'lib/loom/facts/provider.rb', line 31 def create_fact_providers(host_spec, shell, loom_config) @provider_factories.map do |block| block.call(host_spec, shell, loom_config) end.flatten end |
.disable_for_host(host_spec, klass) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/loom/facts/provider.rb', line 12 def disable_for_host(host_spec, klass) Loom.log.warn "disabling fact provider => #{klass} on #{host_spec.hostname}" @disabled_providers ||= {} @disabled_providers[host_spec.hostname] ||= [] @disabled_providers[host_spec.hostname] << klass end |
.disabled_for_host?(host_spec, klass) ⇒ Boolean
19 20 21 22 23 |
# File 'lib/loom/facts/provider.rb', line 19 def disabled_for_host?(host_spec, klass) @disabled_providers ||= {} @disabled_providers[host_spec.hostname] ||= [] @disabled_providers[host_spec.hostname].include? klass end |
Instance Method Details
#collect_facts ⇒ Object
Should return a Hash of fact_name => fact_value entries
43 44 45 |
# File 'lib/loom/facts/provider.rb', line 43 def collect_facts raise 'not implemented' end |
#disable(host_spec) ⇒ Object
38 39 40 |
# File 'lib/loom/facts/provider.rb', line 38 def disable(host_spec) Provider.disable_for_host host_spec, self.class end |