From fb5f859cf4a89042a1768b6cbc2dbfc43da49c99 Mon Sep 17 00:00:00 2001 From: Jesse Wolfe Date: Mon, 1 Nov 2010 11:45:27 -0700 Subject: Fix #5164 Change Facts timestamp when they are received by the master This patch causes the puppet master to re-timestamp facts when they are received by the catalog compiler terminus. This makes the timestamps more trustworthy, as it means that they are all based upon the same clock's time. Paired-With: Paul Berry --- lib/puppet/node/facts.rb | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'lib/puppet/node') diff --git a/lib/puppet/node/facts.rb b/lib/puppet/node/facts.rb index ad4b91e98..d84d54113 100755 --- a/lib/puppet/node/facts.rb +++ b/lib/puppet/node/facts.rb @@ -35,7 +35,7 @@ class Puppet::Node::Facts @name = name @values = values - add_internal + add_timestamp end def downcase_if_necessary @@ -75,13 +75,21 @@ class Puppet::Node::Facts }.to_pson(*args) end - private - # Add internal data to the facts for storage. - def add_internal - self.values[:_timestamp] = Time.now + def add_timestamp + self.timestamp = Time.now + end + + def timestamp=(time) + self.values[:_timestamp] = time end + def timestamp + self.values[:_timestamp] + end + + private + # Strip out that internal data. def strip_internal newvals = values.dup -- cgit