Sha256: 347a55149f11dbed95974b9695f8f14a2d1c5865774cd0f5526a7ab28e7e1da5

Contents?: true

Size: 869 Bytes

Versions: 2

Compression:

Stored size: 869 Bytes

Contents

module PuppetRepl
  module Support
    module Facts
      # in the future we will want to grab real facts from real systems via puppetdb
      # or enc data
      def facterdb_filter
        'operatingsystem=RedHat and operatingsystemrelease=/^7/ and architecture=x86_64 and facterversion=/^2.4\./'
      end

      def set_facts(value)
        @facts = value
      end

      # 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
      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
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
puppet-repl-0.1.1 lib/puppet-repl/support/facts.rb
puppet-repl-0.1.0 lib/puppet-repl/support/facts.rb