summaryrefslogtreecommitdiffstats
path: root/lib/puppet/indirector/code
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2007-10-12 18:00:10 -0500
committerLuke Kanies <luke@madstop.com>2007-10-12 18:00:10 -0500
commit74d77f76a012d523430e43f1092609a4ca584cc7 (patch)
tree482f5510954eb56721b826996195d7f5573aca19 /lib/puppet/indirector/code
parent512096afbd1dde4a63840ded45b4388e2e34048e (diff)
downloadpuppet-74d77f76a012d523430e43f1092609a4ca584cc7.tar.gz
puppet-74d77f76a012d523430e43f1092609a4ca584cc7.tar.xz
puppet-74d77f76a012d523430e43f1092609a4ca584cc7.zip
Adding version handling through most of the indirection work.
This counts as the first commit where configuration compiling actually uses the caching correctly according to the application model.
Diffstat (limited to 'lib/puppet/indirector/code')
-rw-r--r--lib/puppet/indirector/code/configuration.rb20
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/puppet/indirector/code/configuration.rb b/lib/puppet/indirector/code/configuration.rb
index 949926a3c..50728757c 100644
--- a/lib/puppet/indirector/code/configuration.rb
+++ b/lib/puppet/indirector/code/configuration.rb
@@ -47,15 +47,19 @@ class Puppet::Indirector::Code::Configuration < Puppet::Indirector::Code
$0 =~ /puppetmasterd/
end
- # Return the configuration version.
- def version(client = nil, clientip = nil)
- if client and node = Puppet::Node.search(client)
- update_node_check(node)
- return interpreter.configuration_version(node)
+ # Return the configuration version. Here we're returning the
+ # latest of the node, fact, or parse date. These are the
+ # three things that go into compiling a client configuration,
+ # so changes in any of them result in changes.
+ # LAK:FIXME Note that this only works when all three sources
+ # use timestamps; once one of them moves to using real versions,
+ # the comparison stops working.
+ def version(key)
+ if node = Puppet::Node.search(key)
+ return [Puppet::Node.version(key).to_f, Puppet::Node::Facts.version(key).to_f, interpreter.configuration_version(node).to_f].sort[-1]
else
- # Just return something that will always result in a recompile, because
- # this is local.
- return (Time.now + 1000).to_i
+ # This is the standard for "got nothing for ya".
+ 0
end
end