diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-12-27 18:20:37 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-12-27 18:20:37 +0000 |
| commit | 92ff7121ec656b36815b14533fba5e92c165eb08 (patch) | |
| tree | 3bf068822a983aba185db9366ccbba846005e594 /lib/puppet | |
| parent | 8ff7e0c75eda0291a169074c67fa0a90db9c4e7b (diff) | |
| download | puppet-92ff7121ec656b36815b14533fba5e92c165eb08.tar.gz puppet-92ff7121ec656b36815b14533fba5e92c165eb08.tar.xz puppet-92ff7121ec656b36815b14533fba5e92c165eb08.zip | |
Fixing #365. I am not sure what the problem was in previous versions, because the new graphing stuff changed the solution to this problem, but it all works now.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1972 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet')
| -rw-r--r-- | lib/puppet/client/dipper.rb | 12 | ||||
| -rwxr-xr-x | lib/puppet/server/filebucket.rb | 14 | ||||
| -rw-r--r-- | lib/puppet/type/pfile.rb | 7 |
3 files changed, 24 insertions, 9 deletions
diff --git a/lib/puppet/client/dipper.rb b/lib/puppet/client/dipper.rb index a9de76e6f..a3a69ffa4 100644 --- a/lib/puppet/client/dipper.rb +++ b/lib/puppet/client/dipper.rb @@ -26,7 +26,11 @@ module Puppet unless FileTest.exists?(file) raise(BucketError, "File %s does not exist" % file) end - return @driver.addfile(Base64.encode64(File.read(file)),file) + contents = File.read(file) + unless local? + contents = Base64.encode64(contents) + end + return @driver.addfile(contents,file) end # Restore the file @@ -44,8 +48,10 @@ module Puppet if restore #puts "Restoring %s" % file - if tmp = @driver.getfile(sum) - newcontents = Base64.decode64(tmp) + if newcontents = @driver.getfile(sum) + unless local? + newcontents = Base64.decode64(newcontents) + end tmp = "" newsum = Digest::MD5.hexdigest(newcontents) changed = nil diff --git a/lib/puppet/server/filebucket.rb b/lib/puppet/server/filebucket.rb index 3fd4a8f5f..fa86e970b 100755 --- a/lib/puppet/server/filebucket.rb +++ b/lib/puppet/server/filebucket.rb @@ -64,8 +64,10 @@ class Server end # accept a file from a client - def addfile(string,path, client = nil, clientip = nil) - contents = Base64.decode64(string) + def addfile(contents, path, client = nil, clientip = nil) + if client + contents = Base64.decode64(contents) + end md5 = Digest::MD5.hexdigest(contents) bpath, bfile, pathpath = FileBucket.paths(@path,md5) @@ -141,8 +143,12 @@ class Server File.open(bfile) { |of| contents = of.read } - - return Base64.encode64(contents) + + if client + return Base64.encode64(contents) + else + return contents + end end def to_s diff --git a/lib/puppet/type/pfile.rb b/lib/puppet/type/pfile.rb index 0bb67d5bb..c3206414e 100644 --- a/lib/puppet/type/pfile.rb +++ b/lib/puppet/type/pfile.rb @@ -77,8 +77,11 @@ module Puppet # We can't depend on looking this up right now, # we have to do it after all of the objects # have been instantiated. - @bucket = value - value + if bucketobj = Puppet::Type.type(:filebucket)[value] + @bucket = bucketobj.bucket + else + @bucket = value + end else self.fail "Invalid backup type %s" % value.inspect |
