diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-02-08 16:53:34 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-02-08 16:53:34 +0000 |
commit | adda8f095d62ce7533f6c7315b8e22b057943c97 (patch) | |
tree | 28544a3c25987f08e1ef316fbefdc24dcaf225e0 /lib | |
parent | 8e4cf2289d7e29b044f3bad2d1e8011c3d0543b4 (diff) | |
download | puppet-adda8f095d62ce7533f6c7315b8e22b057943c97.tar.gz puppet-adda8f095d62ce7533f6c7315b8e22b057943c97.tar.xz puppet-adda8f095d62ce7533f6c7315b8e22b057943c97.zip |
Checksums now get correctly updated for both the ensure and content state when those states are used
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@883 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/type/pfile.rb | 16 | ||||
-rwxr-xr-x | lib/puppet/type/pfile/checksum.rb | 1 | ||||
-rwxr-xr-x | lib/puppet/type/pfile/content.rb | 2 | ||||
-rwxr-xr-x | lib/puppet/type/pfile/ensure.rb | 6 | ||||
-rw-r--r-- | lib/puppet/type/state.rb | 6 |
5 files changed, 23 insertions, 8 deletions
diff --git a/lib/puppet/type/pfile.rb b/lib/puppet/type/pfile.rb index 2df134c8e..d4779e428 100644 --- a/lib/puppet/type/pfile.rb +++ b/lib/puppet/type/pfile.rb @@ -484,11 +484,19 @@ 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) + # Set the checksum, from another state. There are multiple states that + # modify the contents of a file, and they need the ability to make sure + # that the checksum value is in sync. + def setchecksum(sum = nil) if @states.include? :checksum - @states[:checksum].checksum = sum + if sum + @states[:checksum].checksum = sum + else + # If they didn't pass in a sum, then tell checksum to + # figure it out. + @states[:checksum].retrieve + @states[:checksum].checksum = @states[:checksum].is + end end end diff --git a/lib/puppet/type/pfile/checksum.rb b/lib/puppet/type/pfile/checksum.rb index a71e3d7b8..292470d62 100755 --- a/lib/puppet/type/pfile/checksum.rb +++ b/lib/puppet/type/pfile/checksum.rb @@ -236,7 +236,6 @@ module Puppet # Store the new sum to the state db. def updatesum - self.warning "Updating" result = false state = nil unless state = @parent.cached(:checksums) diff --git a/lib/puppet/type/pfile/content.rb b/lib/puppet/type/pfile/content.rb index 9468f2140..7260579b0 100755 --- a/lib/puppet/type/pfile/content.rb +++ b/lib/puppet/type/pfile/content.rb @@ -53,6 +53,8 @@ module Puppet [@parent.name, detail] end + @parent.setchecksum + if @is == :absent return :file_created else diff --git a/lib/puppet/type/pfile/ensure.rb b/lib/puppet/type/pfile/ensure.rb index 33b6edf96..d726fecb1 100755 --- a/lib/puppet/type/pfile/ensure.rb +++ b/lib/puppet/type/pfile/ensure.rb @@ -102,6 +102,12 @@ module Puppet end + def sync + event = super + @parent.setchecksum + return event + end + def disabled_sync event = nil basedir = File.dirname(@parent.name) diff --git a/lib/puppet/type/state.rb b/lib/puppet/type/state.rb index 26e2fcc65..377e84a65 100644 --- a/lib/puppet/type/state.rb +++ b/lib/puppet/type/state.rb @@ -23,9 +23,9 @@ class State < Puppet::Parameter # "State(%s)" % self.name #end - def to_s - self.inspect - end + #def to_s + # self.inspect + #end end # Parameters just use 'newvalues', since there's no work associated with them. |