Merge lp:~tribaal/charms/trusty/swift-proxy/close-ring-file-proprely into lp:~openstack-charmers-archive/charms/trusty/swift-proxy/next

Proposed by Chris Glass
Status: Merged
Approved by: David Britton
Approved revision: 111
Merged at revision: 111
Proposed branch: lp:~tribaal/charms/trusty/swift-proxy/close-ring-file-proprely
Merge into: lp:~openstack-charmers-archive/charms/trusty/swift-proxy/next
Diff against target: 13 lines (+2/-1)
1 file modified
lib/swift_utils.py (+2/-1)
To merge this branch: bzr merge lp:~tribaal/charms/trusty/swift-proxy/close-ring-file-proprely
Reviewer Review Type Date Requested Status
David Britton (community) Approve
Review via email: mp+271473@code.launchpad.net

Description of the change

This branch simply makes sure the file where the keyring information is written to is properly closed after being written to.

To post a comment you must log in.
Revision history for this message
David Britton (dpb) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/swift_utils.py'
2--- lib/swift_utils.py 2015-09-09 10:51:46 +0000
3+++ lib/swift_utils.py 2015-09-17 13:29:52 +0000
4@@ -383,7 +383,8 @@
5
6 def _write_ring(ring, ring_path):
7 import cPickle as pickle
8- pickle.dump(ring.to_dict(), open(ring_path, 'wb'), protocol=2)
9+ with open(ring_path, "wb") as fd:
10+ pickle.dump(ring.to_dict(), fd, protocol=2)
11
12
13 def ring_port(ring_path, node):

Subscribers

People subscribed via source and target branches