← Back to team overview

duplicity-team team mailing list archive

[Merge] lp:~verb/duplicity/bucket_root_fix into lp:duplicity

 

Lee Verberne has proposed merging lp:~verb/duplicity/bucket_root_fix into lp:duplicity.

Requested reviews:
  duplicity-team (duplicity-team)
Related bugs:
  Bug #1218425 in Duplicity: "New storage_uri functionality breaks put operations for boto"
  https://bugs.launchpad.net/duplicity/+bug/1218425

For more details, see:
https://code.launchpad.net/~verb/duplicity/bucket_root_fix/+merge/184241

This branch fixes a bug that prevents backing up to the root of a bucket with boto backend.
-- 
https://code.launchpad.net/~verb/duplicity/bucket_root_fix/+merge/184241
Your team duplicity-team is requested to review the proposed merge of lp:~verb/duplicity/bucket_root_fix into lp:duplicity.
=== modified file 'duplicity/backends/_boto_single.py'
--- duplicity/backends/_boto_single.py	2013-07-19 22:38:23 +0000
+++ duplicity/backends/_boto_single.py	2013-09-06 07:09:50 +0000
@@ -202,8 +202,7 @@
 
         if not remote_filename:
             remote_filename = source_path.get_filename()
-        key = self.storage_uri.new_key()
-        key.key = self.key_prefix + remote_filename
+        key = self.bucket.new_key(self.key_prefix + remote_filename)
 
         for n in range(1, globals.num_retries+1):
             if n > 1:
@@ -239,14 +238,16 @@
         raise BackendException("Error uploading %s/%s" % (self.straight_url, remote_filename))
 
     def get(self, remote_filename, local_path):
-        key = self.storage_uri.new_key()
-        key.key = self.key_prefix + remote_filename
         for n in range(1, globals.num_retries+1):
             if n > 1:
                 # sleep before retry (new connection to a **hopeful** new host, so no need to wait so long)
                 time.sleep(10)
             log.Info("Downloading %s/%s" % (self.straight_url, remote_filename))
             try:
+                key_name = self.key_prefix + remote_filename
+                key = self.bucket.get_key(key_name)
+                if key is None:
+                    raise BackendException("%s: key not found" % key_name)
                 key.get_contents_to_filename(local_path.name)
                 local_path.setdata()
                 self.resetConnection()


Follow ups