diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-02-08 16:38:45 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-02-08 16:38:45 +0000 |
commit | 8e4cf2289d7e29b044f3bad2d1e8011c3d0543b4 (patch) | |
tree | c025c6bf782a71f7402f856c34c05c8786bfc607 /lib/puppet | |
parent | 58db0ef2ba966334cd65a67a3dc0112af8f8dda2 (diff) | |
download | puppet-8e4cf2289d7e29b044f3bad2d1e8011c3d0543b4.tar.gz puppet-8e4cf2289d7e29b044f3bad2d1e8011c3d0543b4.tar.xz puppet-8e4cf2289d7e29b044f3bad2d1e8011c3d0543b4.zip |
first bug fixed, where sources were not updating the checksum
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@882 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/type/pfile.rb | 14 | ||||
-rwxr-xr-x | lib/puppet/type/pfile/checksum.rb | 13 | ||||
-rwxr-xr-x | lib/puppet/type/pfile/source.rb | 6 |
3 files changed, 26 insertions, 7 deletions
diff --git a/lib/puppet/type/pfile.rb b/lib/puppet/type/pfile.rb index 16193578f..2df134c8e 100644 --- a/lib/puppet/type/pfile.rb +++ b/lib/puppet/type/pfile.rb @@ -484,6 +484,14 @@ module Puppet super end + # This method assumes that the checksum types are all correct, and we + # just want to carry over the value. + def setchecksum(sum) + if @states.include? :checksum + @states[:checksum].checksum = sum + end + end + def stat(refresh = false) if @stat.nil? or refresh == true begin @@ -565,10 +573,10 @@ module Puppet # We put all of the states in separate files, because there are so many # of them. The order these are loaded is important, because it determines # the order they are in the state list. - require 'puppet/type/pfile/ensure' require 'puppet/type/pfile/checksum' - require 'puppet/type/pfile/content' - require 'puppet/type/pfile/source' + require 'puppet/type/pfile/content' # can create the file + require 'puppet/type/pfile/source' # can create the file + require 'puppet/type/pfile/ensure' # can create the file require 'puppet/type/pfile/uid' require 'puppet/type/pfile/group' require 'puppet/type/pfile/mode' diff --git a/lib/puppet/type/pfile/checksum.rb b/lib/puppet/type/pfile/checksum.rb index eac454908..a71e3d7b8 100755 --- a/lib/puppet/type/pfile/checksum.rb +++ b/lib/puppet/type/pfile/checksum.rb @@ -20,6 +20,14 @@ module Puppet @checktypes[0] end + # Because source and content and whomever else need to set the checksum + # and do the updating, we provide a simple mechanism for doing so. + def checksum=(value) + @is = value + @should = [value] + self.updatesum + end + # Checksums need to invert how changes are printed. def change_to_s begin @@ -228,6 +236,7 @@ module Puppet # Store the new sum to the state db. def updatesum + self.warning "Updating" result = false state = nil unless state = @parent.cached(:checksums) @@ -240,10 +249,6 @@ module Puppet error = Puppet::Error.new("%s has invalid checksum" % @parent.name) raise error - #elsif @should == :absent - # error = Puppet::Error.new("%s has invalid 'should' checksum" % - # @parent.name) - # raise error end # if we're replacing, vs. updating diff --git a/lib/puppet/type/pfile/source.rb b/lib/puppet/type/pfile/source.rb index d6a11dd7a..4244080dd 100755 --- a/lib/puppet/type/pfile/source.rb +++ b/lib/puppet/type/pfile/source.rb @@ -275,6 +275,12 @@ module Puppet [@parent.name, detail] end + if @stats.include? :checksum + @parent.setchecksum @stats[:checksum] + else + raise Puppet::DevError, "We're somehow missing the remote checksum" + end + if exists return :file_changed else |