class Puppet::FacterImpl

Public Class Methods

new() click to toggle source
   # File lib/puppet/facter_impl.rb
10 def initialize
11   require 'facter'
12 
13   setup_logging
14 end

Public Instance Methods

add(name, &block) click to toggle source
   # File lib/puppet/facter_impl.rb
20 def add(name, &block)
21   ::Facter.add(name, &block)
22 end
clear() click to toggle source
   # File lib/puppet/facter_impl.rb
28 def clear
29   ::Facter.clear
30 end
debugging(value) click to toggle source
   # File lib/puppet/facter_impl.rb
52 def debugging(value)
53   ::Facter.debugging(value) if ::Facter.respond_to?(:debugging)
54 end
load_external(value) click to toggle source
   # File lib/puppet/facter_impl.rb
60 def load_external(value)
61   ::Facter.load_external(value) if self.load_external?
62 end
load_external?() click to toggle source
   # File lib/puppet/facter_impl.rb
56 def load_external?
57   ::Facter.respond_to?(:load_external)
58 end
reset() click to toggle source
   # File lib/puppet/facter_impl.rb
32 def reset
33   ::Facter.reset
34 end
resolve(options) click to toggle source
   # File lib/puppet/facter_impl.rb
36 def resolve(options)
37   ::Facter.resolve(options)
38 end
search_external(dirs) click to toggle source
   # File lib/puppet/facter_impl.rb
40 def search_external(dirs)
41   ::Facter.search_external(dirs)
42 end
to_hash() click to toggle source
   # File lib/puppet/facter_impl.rb
24 def to_hash
25   ::Facter.to_hash
26 end
trace(value) click to toggle source
   # File lib/puppet/facter_impl.rb
48 def trace(value)
49   ::Facter.trace(value) if ::Facter.respond_to? :trace
50 end
value(fact_name) click to toggle source
   # File lib/puppet/facter_impl.rb
16 def value(fact_name)
17   ::Facter.value(fact_name)
18 end

Private Instance Methods

setup_logging() click to toggle source
   # File lib/puppet/facter_impl.rb
66 def setup_logging
67   return unless ::Facter.respond_to? :on_message
68 
69   ::Facter.on_message do |level, message|
70     case level
71     when :trace, :debug
72       level = :debug
73     when :info
74       # Same as Puppet
75     when :warn
76       level = :warning
77     when :error
78       level = :err
79     when :fatal
80       level = :crit
81     else
82       next
83     end
84 
85     Puppet::Util::Log.create(
86       {
87         :level => level,
88         :source => 'Facter',
89         :message => message
90       }
91     )
92     nil
93   end
94 end