Merge lp:~johnleach/duplicity/1315437-swift-container-create into lp:duplicity/0.6

Proposed by John Leach
Status: Merged
Merged at revision: 980
Proposed branch: lp:~johnleach/duplicity/1315437-swift-container-create
Merge into: lp:duplicity/0.6
Diff against target: 34 lines (+17/-5)
1 file modified
duplicity/backends/swiftbackend.py (+17/-5)
To merge this branch: bzr merge lp:~johnleach/duplicity/1315437-swift-container-create
Reviewer Review Type Date Requested Status
duplicity-team Pending
Review via email: mp+218373@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'duplicity/backends/swiftbackend.py'
2--- duplicity/backends/swiftbackend.py 2014-04-29 23:49:01 +0000
3+++ duplicity/backends/swiftbackend.py 2014-05-06 10:20:37 +0000
4@@ -72,13 +72,25 @@
5
6 self.container = parsed_url.path.lstrip('/')
7
8+ container_metadata = None
9 try:
10 self.conn = Connection(**conn_kwargs)
11- self.conn.put_container(self.container)
12- except Exception as e:
13- log.FatalError("Connection failed: %s %s"
14- % (e.__class__.__name__, util.uexc(e)),
15- log.ErrorCode.connection_failed)
16+ container_metadata = self.conn.head_container(self.container)
17+ except ClientException:
18+ pass
19+ except Exception, e:
20+ log.FatalError("Connection failed: %s %s"
21+ % (e.__class__.__name__, str(e)),
22+ log.ErrorCode.connection_failed)
23+
24+ if container_metadata is None:
25+ log.Info("Creating container %s" % self.container)
26+ try:
27+ self.conn.put_container(self.container)
28+ except Exception, e:
29+ log.FatalError("Container creation failed: %s %s"
30+ % (e.__class__.__name__, str(e)),
31+ log.ErrorCode.connection_failed)
32
33 def _error_code(self, operation, e):
34 if isinstance(e, self.resp_exc):

Subscribers

People subscribed via source and target branches

to all changes: