Class: Loom::Facts::Provider
- Inherits:
-
Object
- Object
- Loom::Facts::Provider
show all
- Defined in:
- lib/loom/facts/provider.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Instance Attribute Details
#fact_map ⇒ Object
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
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
27
28
29
30
31
|
# File 'lib/loom/facts/provider.rb', line 27
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
8
9
10
11
12
13
|
# File 'lib/loom/facts/provider.rb', line 8
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
15
16
17
18
19
|
# File 'lib/loom/facts/provider.rb', line 15
def disabled_for_host?(host_spec, klass)
@disabled_providers ||= {}
@disabled_providers[host_spec.hostname] ||= []
@disabled_providers[host_spec.hostname].include? klass
end
|
.register_factory(klass, &block) ⇒ Object
21
22
23
24
25
|
# File 'lib/loom/facts/provider.rb', line 21
def register_factory(klass, &block)
@provider_factories ||= []
@provider_factories << block
Loom.log.debug1(self) { "registered fact provider => #{klass}" }
end
|
Instance Method Details
#collect_facts ⇒ Object
Should return a Hash of fact_name => fact_value entries
39
40
41
|
# File 'lib/loom/facts/provider.rb', line 39
def collect_facts
raise 'not implemented'
end
|
#disable(host_spec) ⇒ Object
34
35
36
|
# File 'lib/loom/facts/provider.rb', line 34
def disable(host_spec)
Provider.disable_for_host host_spec, self.class
end
|