summaryrefslogtreecommitdiffstats
path: root/lib/puppet/client
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-04-17 16:15:33 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-04-17 16:15:33 +0000
commitd56870cff9fac4704de91dee9ef3138bf0a80ff4 (patch)
treeb153b1d34e2f8bf1290ff55a393821363725ca5f /lib/puppet/client
parent0478f78b2291b9c54b4de9807fd0a0f216eaed53 (diff)
downloadpuppet-d56870cff9fac4704de91dee9ef3138bf0a80ff4.tar.gz
puppet-d56870cff9fac4704de91dee9ef3138bf0a80ff4.tar.xz
puppet-d56870cff9fac4704de91dee9ef3138bf0a80ff4.zip
Fixing a bunch of small bugs, mostly found by testing on solaris, and added a check to the test system that points out memory growth
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1113 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/client')
-rw-r--r--lib/puppet/client/dipper.rb18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/puppet/client/dipper.rb b/lib/puppet/client/dipper.rb
index 0ad1926ab..bc85236a3 100644
--- a/lib/puppet/client/dipper.rb
+++ b/lib/puppet/client/dipper.rb
@@ -6,6 +6,7 @@ module Puppet
attr_accessor :name
+ # Create our bucket client
def initialize(hash = {})
if hash.include?(:Path)
bucket = Puppet::Server::FileBucket.new(
@@ -18,26 +19,25 @@ module Puppet
super(hash)
end
+ # Back up a file to our bucket
def backup(file)
unless FileTest.exists?(file)
- raise(BucketError, "File %s does not exist" % file, caller)
+ raise(BucketError, "File %s does not exist" % file)
end
- contents = File.open(file) { |of| of.read }
-
+ contents = File.read(file)
string = Base64.encode64(contents)
- #puts "string is created"
sum = @driver.addfile(string,file)
- #puts "file %s is added" % file
+ string = ""
+ contents = ""
return sum
end
+ # Restore the file
def restore(file,sum)
restore = true
if FileTest.exists?(file)
- contents = File.open(file) { |of| of.read }
-
- cursum = Digest::MD5.hexdigest(contents)
+ cursum = Digest::MD5.hexdigest(File.read(file))
# if the checksum has changed...
# this might be extra effort
@@ -50,6 +50,7 @@ module Puppet
#puts "Restoring %s" % file
if tmp = @driver.getfile(sum)
newcontents = Base64.decode64(tmp)
+ tmp = ""
newsum = Digest::MD5.hexdigest(newcontents)
changed = nil
unless FileTest.writable?(file)
@@ -71,7 +72,6 @@ module Puppet
else
return nil
end
-
end
end
end