Module: Puppet::Configurer::FactHandler
- Included in:
- Puppet::Configurer
- Defined in:
- lib/puppet/configurer/fact_handler.rb
Overview
Break out the code related to facts. This module is just included into the agent, but having it here makes it easier to test.
Instance Method Summary collapse
Instance Method Details
#facts_for_uploading ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/puppet/configurer/fact_handler.rb', line 30 def facts_for_uploading facts = find_facts text = facts.render(:pson) {:facts_format => :pson, :facts => CGI.escape(text)} end |
#find_facts ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/puppet/configurer/fact_handler.rb', line 10 def find_facts # This works because puppet agent configures Facts to use 'facter' for # finding facts and the 'rest' terminus for caching them. Thus, we'll # compile them and then "cache" them on the server. begin facts = Puppet::Node::Facts.indirection.find(Puppet[:node_name_value], :environment => @environment) unless Puppet[:node_name_fact].empty? Puppet[:node_name_value] = facts.values[Puppet[:node_name_fact]] facts.name = Puppet[:node_name_value] end facts rescue SystemExit,NoMemoryError raise rescue Exception => detail = "Could not retrieve local facts: #{detail}" Puppet.log_exception(detail, ) raise Puppet::Error, , detail.backtrace end end |