Merge "Image fix bug with --volume"
This commit is contained in:
commit
e926998700
@ -213,6 +213,8 @@ class CreateImage(show.ShowOne):
|
|||||||
if parsed_args.private:
|
if parsed_args.private:
|
||||||
kwargs['is_public'] = False
|
kwargs['is_public'] = False
|
||||||
|
|
||||||
|
info = {}
|
||||||
|
|
||||||
if not parsed_args.location and not parsed_args.copy_from:
|
if not parsed_args.location and not parsed_args.copy_from:
|
||||||
if parsed_args.volume:
|
if parsed_args.volume:
|
||||||
volume_client = self.app.client_manager.volume
|
volume_client = self.app.client_manager.volume
|
||||||
@ -241,18 +243,18 @@ class CreateImage(show.ShowOne):
|
|||||||
# do a chunked transfer
|
# do a chunked transfer
|
||||||
kwargs["data"] = sys.stdin
|
kwargs["data"] = sys.stdin
|
||||||
|
|
||||||
# Wrap the call to catch exceptions in order to close files
|
if not parsed_args.volume:
|
||||||
try:
|
# Wrap the call to catch exceptions in order to close files
|
||||||
image = image_client.images.create(**kwargs)
|
try:
|
||||||
finally:
|
image = image_client.images.create(**kwargs)
|
||||||
# Clean up open files - make sure data isn't a string
|
finally:
|
||||||
if ('data' in kwargs and hasattr(kwargs['data'], 'close') and
|
# Clean up open files - make sure data isn't a string
|
||||||
kwargs['data'] != sys.stdin):
|
if ('data' in kwargs and hasattr(kwargs['data'], 'close') and
|
||||||
kwargs['data'].close()
|
kwargs['data'] != sys.stdin):
|
||||||
|
kwargs['data'].close()
|
||||||
|
|
||||||
info = {}
|
info.update(image._info)
|
||||||
info.update(image._info)
|
info['properties'] = utils.format_dict(info.get('properties', {}))
|
||||||
info['properties'] = utils.format_dict(info.get('properties', {}))
|
|
||||||
return zip(*sorted(six.iteritems(info)))
|
return zip(*sorted(six.iteritems(info)))
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user