[pkg-eucalyptus-commits] [euca2ools] 34/41: Close bundle writer's input pipe when it exits

Charles Plessy plessy at alioth.debian.org
Sat Oct 12 03:24:23 UTC 2013


This is an automated email from the git hooks/post-receive script.

plessy pushed a commit to branch master
in repository euca2ools.

commit 9e3ac437a8e0375c6dac3b4e0c63cbb4d7480f6b
Author: Garrett Holmstrom <gholms at fedoraproject.org>
Date:   Tue Sep 24 15:04:18 2013 -0700

    Close bundle writer's input pipe when it exits
    
    Fixes TOOLS-335
---
 euca2ools/commands/bundle/bundle.py |   19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/euca2ools/commands/bundle/bundle.py b/euca2ools/commands/bundle/bundle.py
index e1033ce..149c991 100644
--- a/euca2ools/commands/bundle/bundle.py
+++ b/euca2ools/commands/bundle/bundle.py
@@ -188,14 +188,17 @@ class Bundle(object):
     def _write_parts(self, infile, part_prefix, part_size):
         with self._lock:
             self.parts = []
-        for part_no in itertools.count():
-            part_fname = '{0}.part.{1}'.format(part_prefix, part_no)
-            part_info = _write_single_part(infile, part_fname, part_size)
-            with self._lock:
-                self.parts.append(part_info)
-            if part_info['size'] < part_size:
-                # That's the last part
-                return
+        try:
+            for part_no in itertools.count():
+                part_fname = '{0}.part.{1}'.format(part_prefix, part_no)
+                part_info = _write_single_part(infile, part_fname, part_size)
+                with self._lock:
+                    self.parts.append(part_info)
+                if part_info['size'] < part_size:
+                    # That's the last part
+                    return
+        finally:
+            infile.close()
 
     def extract_image(self, destdir, progressbar=None):
         assert self.digest_algorithm == 'SHA1'

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-eucalyptus/euca2ools.git



More information about the pkg-eucalyptus-commits mailing list