Sha256: 812c4700d2acd2b8f974abadc45300d9ffc8d99c2ea9bc7ebbe56987d7bf96d4

Contents?: true

Size: 1.18 KB

Versions: 68

Compression:

Stored size: 1.18 KB

Contents

require 'puppet/indirector/facts/facter'

require 'puppet/configurer'
require 'puppet/configurer/downloader'

# Break out the code related to facts.  This module is
# just included into the agent, but having it here makes it
# easier to test.
module Puppet::Configurer::FactHandler
  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
      message = "Could not retrieve local facts: #{detail}"
      Puppet.log_exception(detail, message)
      raise Puppet::Error, message, detail.backtrace
    end
  end

  def facts_for_uploading
    facts = find_facts

    text = facts.render(:pson)

    {:facts_format => :pson, :facts => CGI.escape(text)}
  end
end

Version data entries

68 entries across 68 versions & 2 rubygems

Version Path
puppet-retrospec-0.12.2 vendor/gems/puppet-3.7.3/lib/puppet/configurer/fact_handler.rb
puppet-3.8.7 lib/puppet/configurer/fact_handler.rb
puppet-3.8.7-x86-mingw32 lib/puppet/configurer/fact_handler.rb
puppet-3.8.7-x64-mingw32 lib/puppet/configurer/fact_handler.rb
puppet-3.8.6 lib/puppet/configurer/fact_handler.rb
puppet-3.8.6-x86-mingw32 lib/puppet/configurer/fact_handler.rb
puppet-retrospec-0.12.1 vendor/gems/puppet-3.7.3/lib/puppet/configurer/fact_handler.rb
puppet-3.8.6-x64-mingw32 lib/puppet/configurer/fact_handler.rb
puppet-retrospec-0.12.0 vendor/gems/puppet-3.7.3/lib/puppet/configurer/fact_handler.rb
puppet-3.8.5 lib/puppet/configurer/fact_handler.rb
puppet-3.8.5-x86-mingw32 lib/puppet/configurer/fact_handler.rb
puppet-3.8.5-x64-mingw32 lib/puppet/configurer/fact_handler.rb
puppet-3.8.4 lib/puppet/configurer/fact_handler.rb
puppet-3.8.4-x86-mingw32 lib/puppet/configurer/fact_handler.rb
puppet-3.8.4-x64-mingw32 lib/puppet/configurer/fact_handler.rb
puppet-retrospec-0.11.0 vendor/gems/puppet-3.7.3/lib/puppet/configurer/fact_handler.rb
puppet-retrospec-0.10.0 vendor/gems/puppet-3.7.3/lib/puppet/configurer/fact_handler.rb
puppet-retrospec-0.9.1 vendor/gems/puppet-3.7.3/lib/puppet/configurer/fact_handler.rb
puppet-retrospec-0.9.0 vendor/gems/puppet-3.7.3/lib/puppet/configurer/fact_handler.rb
puppet-retrospec-0.8.1 vendor/gems/puppet-3.7.3/lib/puppet/configurer/fact_handler.rb