The Boto S3Connection provides two methods to connect to a S3 bucket;
get_bucket() raises an exception if there is an issue, while lookup()
returns None if there is an error, hiding the cause of problem.

Duplicity uses the lookup() method and then raises this generic
exception (BackendException: No connection to backend) if None is
returned. The problem is that there are all sorts of reasons why the
connection to the bucket didn't succeed and this is hidden from the end
user, making debugging S3 connection issues more troublesome than
necessary.

A solution would be to use the get_bucket() method, wrap it in a try
catch block and then, on error, raise a BackendException using the
message from the previous exception.

For Duplicity 0.7 this would look like:
/duplicity/backends/_boto_single.py (revision 1041) in resetConnection() line 
184
-         self.bucket = self.conn.lookup(self.bucket_name)
+        try:
+            self.bucket = self.conn.get_bucket(self.bucket_name)
+        except Exception as err:
+            raise BackendException(err.message)

-- 
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to python-boto in Ubuntu.
https://bugs.launchpad.net/bugs/1278529

Title:
  Using S3, "BackendException: No connection to backend"

To manage notifications about this bug go to:
https://bugs.launchpad.net/duplicity/+bug/1278529/+subscriptions

-- 
Ubuntu-server-bugs mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs

Reply via email to