diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-03-12 02:56:23 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-03-12 02:56:23 +0000 |
| commit | 5a47afdd4f8f51c9403a83712eaa700913fd93c4 (patch) | |
| tree | ecc7e3fe8d943bcedd8895efe5489ac796308500 /lib/puppet/server | |
| parent | 1b11697157c712bdfcee9058e0e64faf934a4ecc (diff) | |
Fixing #98. Filebuckets now work throughout the system, and the puppetmasterd creates one by default. I have also updated the :backup docs, adding an example.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1012 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/server')
| -rwxr-xr-x | lib/puppet/server/filebucket.rb | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/lib/puppet/server/filebucket.rb b/lib/puppet/server/filebucket.rb index fc1c690fd..704d1c76d 100755 --- a/lib/puppet/server/filebucket.rb +++ b/lib/puppet/server/filebucket.rb @@ -3,10 +3,8 @@ require 'webrick' -#require 'webrick/https' require 'xmlrpc/server' require 'xmlrpc/client' -#require 'webrick/httpstatus' require 'facter' require 'digest/md5' require 'puppet/base64' @@ -29,6 +27,9 @@ class Server iface.add_method("string getfile(string)") } + Puppet::Util.logmethods(self, true) + attr_reader :name + # this doesn't work for relative paths def FileBucket.paths(base,md5) return [ @@ -59,7 +60,9 @@ class Server end end - Puppet.recmkdir(@bucket) + Puppet.config.use(:filebucket) + + @name = "filebucket[#{Puppet[:bucketdir]}]" end # accept a file from a client @@ -75,9 +78,12 @@ class Server # if it's a new directory... if Puppet.recmkdir(bpath) + msg = "Adding %s(%s)" % [path, md5] + msg += " from #{client}" if client + self.info msg # ...then just create the file #puts "creating file" - File.open(bfile, File::WRONLY|File::CREAT) { |of| + File.open(bfile, File::WRONLY|File::CREAT, 0440) { |of| of.print contents } #puts "File is created" @@ -99,6 +105,10 @@ class Server if curfile != contents raise(BucketError, "Got passed new contents for sum %s" % md5, caller) + else + msg = "Got duplicate %s(%s)" % [path, md5] + msg += " from #{client}" if client + self.info msg end end #puts "Conflict check is done" @@ -146,7 +156,10 @@ class Server return Base64.encode64(contents) end - #--------------------------------------------------------------- + + def to_s + self.name + end end end end |
