diff options
author | Luke Kanies <luke@madstop.com> | 2009-01-22 16:51:02 -0600 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2009-02-06 18:08:41 -0600 |
commit | e65d7f11dd95ab5432adefeabc3179e9eb5dd050 (patch) | |
tree | 52ad7eabbe7b07d5f7496587e40019cbe4e3a76e /lib/puppet/node/facts.rb | |
parent | 6b4e5f49a8d1d062aefae31a923cff9e3f0d31ba (diff) | |
download | puppet-e65d7f11dd95ab5432adefeabc3179e9eb5dd050.tar.gz puppet-e65d7f11dd95ab5432adefeabc3179e9eb5dd050.tar.xz puppet-e65d7f11dd95ab5432adefeabc3179e9eb5dd050.zip |
Refactoring how the Facter integration works
I moved all of the extra Fact modifications into the Facts
class, and then moved the calls of those new methods
into the Facter terminus.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib/puppet/node/facts.rb')
-rwxr-xr-x | lib/puppet/node/facts.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/puppet/node/facts.rb b/lib/puppet/node/facts.rb index 8ee90b4ac..dca435c7d 100755 --- a/lib/puppet/node/facts.rb +++ b/lib/puppet/node/facts.rb @@ -21,6 +21,11 @@ class Puppet::Node::Facts attr_accessor :name, :values + def add_local_facts + values["clientversion"] = Puppet.version.to_s + values["environment"] ||= Puppet.settings[:environment] + end + def initialize(name, values = {}) @name = name @values = values @@ -28,6 +33,22 @@ class Puppet::Node::Facts add_internal end + def downcase_if_necessary + return unless Puppet.settings[:downcasefacts] + + Puppet.warning "DEPRECATION NOTICE: Fact downcasing is deprecated; please disable (20080122)" + values.each do |fact, value| + values[fact] = value.downcase if value.is_a?(String) + end + end + + # Convert all fact values into strings. + def stringify + values.each do |fact, value| + values[fact] = value.to_s + end + end + private # Add internal data to the facts for storage. |