summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-05-15 00:11:01 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-05-15 00:11:01 +0000
commit28f7d6c7ebd56da3014464c82c73a4f98f3406ea (patch)
tree0fed5116baef8f988eb88617df2fc1a6e20c97e0 /lib
parentd9f6f418639fb50297a9a0b5415ea57b5f2f303e (diff)
downloadpuppet-28f7d6c7ebd56da3014464c82c73a4f98f3406ea.tar.gz
puppet-28f7d6c7ebd56da3014464c82c73a4f98f3406ea.tar.xz
puppet-28f7d6c7ebd56da3014464c82c73a4f98f3406ea.zip
Fixing #569 - I have added a dynamic facts option to choose which facts will be ignored.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2516 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/configuration.rb6
-rw-r--r--lib/puppet/network/client/master.rb17
2 files changed, 18 insertions, 5 deletions
diff --git a/lib/puppet/configuration.rb b/lib/puppet/configuration.rb
index c6ca53d98..3b90916c6 100644
--- a/lib/puppet/configuration.rb
+++ b/lib/puppet/configuration.rb
@@ -396,7 +396,11 @@ module Puppet
change or if the server changes."
],
:downcasefacts => [false,
- "Whether facts should be made all lowercase when sent to the server."]
+ "Whether facts should be made all lowercase when sent to the server."],
+ :dynamicfacts => ["memorysize,memoryfree,swapsize,swapfree",
+ "Facts that are dynamic; these facts will be ignored when deciding whether
+ changed facts should result in a recompile. Multiple facts should be
+ comma-separated."]
)
self.setdefaults(:puppetd,
diff --git a/lib/puppet/network/client/master.rb b/lib/puppet/network/client/master.rb
index 6db2e98c7..e7739ba34 100644
--- a/lib/puppet/network/client/master.rb
+++ b/lib/puppet/network/client/master.rb
@@ -41,6 +41,11 @@ class Puppet::Network::Client::Master < Puppet::Network::Client
facts
end
+ # Return the list of dynamic facts as an array of symbols
+ def self.dynamic_facts
+ Puppet.config[:dynamicfacts].split(/\s*,\s*/).collect { |fact| fact.downcase }
+ end
+
# This method actually applies the configuration.
def apply(tags = nil, ignoreschedules = false)
unless defined? @objects
@@ -536,13 +541,17 @@ class Puppet::Network::Client::Master < Puppet::Network::Client
end
loadfacts()
-
- private
# Have the facts changed since we last compiled?
def facts_changed?(facts)
- oldfacts = Puppet::Util::Storage.cache(:configuration)[:facts]
- newfacts = facts
+ oldfacts = Puppet::Util::Storage.cache(:configuration)[:facts].dup
+ newfacts = facts.dup
+ self.class.dynamic_facts.each do |fact|
+ [oldfacts, newfacts].each do |facthash|
+ facthash.delete(fact) if facthash.include?(fact)
+ end
+ end
+
if oldfacts == newfacts
return false
else