diff options
| author | Luke Kanies <luke@madstop.com> | 2005-07-11 20:51:52 +0000 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2005-07-11 20:51:52 +0000 |
| commit | 75e27cf8f387816526860df3ad0d38ddce8eeb01 (patch) | |
| tree | a9a251e7e28a6573ad654eb7ef94fe29e42fb97a /lib | |
| parent | 0417fb59f4493b98fea9b03a60cb21ffc0f8bed4 (diff) | |
| download | puppet-75e27cf8f387816526860df3ad0d38ddce8eeb01.tar.gz puppet-75e27cf8f387816526860df3ad0d38ddce8eeb01.tar.xz puppet-75e27cf8f387816526860df3ad0d38ddce8eeb01.zip | |
cleaning up bugs in the tests, and adding more error checking around the bugs
git-svn-id: https://reductivelabs.com/svn/puppet/library/trunk@359 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/puppet/storage.rb | 8 | ||||
| -rw-r--r-- | lib/puppet/type/pfile.rb | 15 |
2 files changed, 19 insertions, 4 deletions
diff --git a/lib/puppet/storage.rb b/lib/puppet/storage.rb index 67969c76f..eb639e32e 100644 --- a/lib/puppet/storage.rb +++ b/lib/puppet/storage.rb @@ -38,7 +38,13 @@ module Puppet file.each { |line| myclass, key, value = line.split(@@splitchar) - @@state[eval(myclass)][key] = Marshal::load(value) + begin + @@state[eval(myclass)][key] = Marshal::load(value) + rescue => detail + raise RuntimeError, "Failed to load value for %s::%s => %s" % [ + myclass,key,detail + ], caller + end } } diff --git a/lib/puppet/type/pfile.rb b/lib/puppet/type/pfile.rb index 6b4ecbc5d..94ef94736 100644 --- a/lib/puppet/type/pfile.rb +++ b/lib/puppet/type/pfile.rb @@ -55,15 +55,15 @@ module Puppet if hash = state[self.parent[:path]] if hash.include?(@checktype) @should = hash[@checktype] - Puppet.warning "Found checksum %s for %s" % + Puppet.debug "Found checksum %s for %s" % [@should,self.parent[:path]] else - Puppet.warning "Found checksum for %s but not of type %s" % + Puppet.debug "Found checksum for %s but not of type %s" % [self.parent[:path],@checktype] @should = nil end else - Puppet.warning "No checksum for %s" % self.parent[:path] + Puppet.debug "No checksum for %s" % self.parent[:path] end end @@ -121,13 +121,19 @@ module Puppet Puppet.err "@is is nil" end if self.updatesum + # set the @should value to the new @is value + # most important for testing + @should = @is return :file_modified else + # set the @should value, because it starts out as nil + @should = @is return nil end end def updatesum + result = false state = Puppet::Storage.state(self) unless state.include?(self.parent[:path]) Puppet.debug "Initializing state hash for %s" % @@ -137,6 +143,9 @@ module Puppet end # if we're replacing, vs. updating if state[self.parent[:path]].include?(@checktype) + unless defined? @should + raise "@should is not initialized for %s, even though we found a checksum" % self.parent[:path] + end Puppet.debug "Replacing checksum %s with %s" % [state[self.parent[:path]][@checktype],@is] Puppet.debug "@is: %s; @should: %s" % [@is,@should] |
