Class: LoomExt::CoreFacts::FacterProvider
- Inherits:
-
Loom::Facts::Provider
- Object
- Loom::Facts::Provider
- LoomExt::CoreFacts::FacterProvider
- Defined in:
- lib/loomext/corefacts/facter_provider.rb
Instance Attribute Summary
Attributes inherited from Loom::Facts::Provider
Instance Method Summary collapse
- #collect_facts ⇒ Object
-
#initialize(host_spec, shell) ⇒ FacterProvider
constructor
A new instance of FacterProvider.
Methods inherited from Loom::Facts::Provider
create_fact_providers, #disable, disable_for_host, disabled_for_host?, register_factory
Constructor Details
#initialize(host_spec, shell) ⇒ FacterProvider
Returns a new instance of FacterProvider.
8 9 10 11 12 13 |
# File 'lib/loomext/corefacts/facter_provider.rb', line 8 def initialize(host_spec, shell) @has_facter = shell.test :which, "facter" disable(host_spec) unless @has_facter @shell = shell @namespace = :facter end |
Instance Method Details
#collect_facts ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/loomext/corefacts/facter_provider.rb', line 15 def collect_facts unless @has_facter Loom.log.error "facter not installed" return {} end yaml_facts = @shell.capture :facter, "--yaml" yaml_facts.nil? ? {} : YAML.load(yaml_facts) end |