Class: OctocatalogDiff::CatalogUtil::Facts
- Inherits:
-
Object
- Object
- OctocatalogDiff::CatalogUtil::Facts
- Defined in:
- lib/octocatalog-diff/catalog-util/facts.rb
Overview
Helper class to construct a fact object based on options provided by cli/options. Supports a direct fact file, looking up a YAML file based on node name within Puppet fact directories, or retrieving from PuppetDB.
Instance Method Summary collapse
-
#facts ⇒ Hash
Compute facts if needed and then return them.
-
#initialize(options, logger = nil) ⇒ Facts
constructor
Constructor.
Constructor Details
#initialize(options, logger = nil) ⇒ Facts
Constructor
14 15 16 17 18 19 20 21 22 |
# File 'lib/octocatalog-diff/catalog-util/facts.rb', line 14 def initialize(, logger = nil) raise ArgumentError, "Argument to constructor must be Hash not #{.class}" unless .is_a?(Hash) @options = .dup @logger = logger # Environment variable recognition @options[:puppetdb_url] ||= ENV['PUPPETDB_URL'] if ENV['PUPPETDB_URL'] @options[:puppet_fact_dir] ||= ENV['PUPPET_FACT_DIR'] if ENV['PUPPET_FACT_DIR'] end |
Instance Method Details
#facts ⇒ Hash
Compute facts if needed and then return them
26 27 28 |
# File 'lib/octocatalog-diff/catalog-util/facts.rb', line 26 def facts @facts ||= compute_facts end |