diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/defaults.rb | 6 | ||||
-rw-r--r-- | lib/puppet/parser/parser_support.rb | 12 |
2 files changed, 16 insertions, 2 deletions
diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index 9444e1164..b1fddc3a3 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -188,7 +188,11 @@ module Puppet :hook => proc do |value| Puppet.settings[:storeconfigs] = true if value end - } + }, + :config_version => ["", "How to determine the configuration version. By default, it will be the + time that the configuration is parsed, but you can provide a shell script to override how the + version is determined. The output of this script will be added to every log message in the + reports, allowing you to correlate changes on your hosts to the source version on the server."] ) hostname = Facter["hostname"].value diff --git a/lib/puppet/parser/parser_support.rb b/lib/puppet/parser/parser_support.rb index b13fbb47f..f1c1da0b0 100644 --- a/lib/puppet/parser/parser_support.rb +++ b/lib/puppet/parser/parser_support.rb @@ -437,7 +437,6 @@ class Puppet::Parser::Parser # Store the results as the top-level class. newclass("", :code => main) end - @version = Time.now.to_i return @loaded_code ensure @lexer.clear @@ -456,6 +455,17 @@ class Puppet::Parser::Parser @lexer.string = string end + def version + return @version if defined?(@version) + + if Puppet[:config_version] == "" + @version = Time.now.to_i + return @version + end + + @version = %x{#{Puppet[:config_version]}}.chomp + end + # Add a new file to be checked when we're checking to see if we should be # reparsed. This is basically only used by the TemplateWrapper to let the # parser know about templates that should be parsed. |