Module: PuppetRepl::Support::Facts
- Included in:
- PuppetRepl::Support
- Defined in:
- lib/puppet-repl/support/facts.rb
Instance Method Summary collapse
-
#default_facts ⇒ Object
uses facterdb (cached facts) and retrives the facts given a filter creates a new facts object we could also use fact_merge to get real facts from the real system or puppetdb.
-
#facterdb_filter ⇒ Object
in the future we will want to grab real facts from real systems via puppetdb or enc data.
- #server_facts ⇒ Object
- #set_facts(value) ⇒ Object
Instance Method Details
#default_facts ⇒ Object
uses facterdb (cached facts) and retrives the facts given a filter creates a new facts object we could also use fact_merge to get real facts from the real system or puppetdb
17 18 19 20 21 22 23 24 |
# File 'lib/puppet-repl/support/facts.rb', line 17 def default_facts unless @facts node_facts = FacterDB.get_facts(facterdb_filter).first values = Hash[ node_facts.map { |k, v| [k.to_s, v] } ] @facts ||= Puppet::Node::Facts.new(values['fqdn'], values) end @facts end |
#facterdb_filter ⇒ Object
in the future we will want to grab real facts from real systems via puppetdb or enc data
6 7 8 |
# File 'lib/puppet-repl/support/facts.rb', line 6 def facterdb_filter 'operatingsystem=RedHat and operatingsystemrelease=/^7/ and architecture=x86_64 and facterversion=/^2.4\./' end |
#server_facts ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/puppet-repl/support/facts.rb', line 26 def server_facts data = {} data["servername"] = Facter.value("fqdn") data['serverip'] = Facter.value("ipaddress") data["serverversion"] = Puppet.version.to_s data end |
#set_facts(value) ⇒ Object
10 11 12 |
# File 'lib/puppet-repl/support/facts.rb', line 10 def set_facts(value) @facts = value end |