diff options
Diffstat (limited to 'glanceclient/common/utils.py')
-rw-r--r-- | glanceclient/common/utils.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/glanceclient/common/utils.py b/glanceclient/common/utils.py index 9016860..7410b3b 100644 --- a/glanceclient/common/utils.py +++ b/glanceclient/common/utils.py @@ -442,7 +442,11 @@ class IterableWithLength(object): self.length = length def __iter__(self): - return self.iterable + try: + for chunk in self.iterable: + yield chunk + finally: + self.iterable.close() def next(self): return next(self.iterable) |