diff options
author | Eric Harney <eharney@redhat.com> | 2019-03-27 11:16:15 -0400 |
---|---|---|
committer | Eric Harney <eharney@redhat.com> | 2019-04-03 11:34:40 -0400 |
commit | 274fa111696783e846561d12f670967ed01ebcbc (patch) | |
tree | 53dd829c8ff0206a8d39ec0a2c47f074d39fcd92 /cinderclient/shell_utils.py | |
parent | 8804b7c978ebf056fa66e09b702355e44da71040 (diff) | |
download | python-cinderclient-274fa111696783e846561d12f670967ed01ebcbc.tar.gz |
Fix shell upload-to-image with no volume type
Upload-to-image would error after launching
the operation if the volume type is None.
Closes-Bug: #1821818
Change-Id: I015e0ddfa98d62f25334e2df5effaee72a3988ab
Diffstat (limited to 'cinderclient/shell_utils.py')
-rw-r--r-- | cinderclient/shell_utils.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/cinderclient/shell_utils.py b/cinderclient/shell_utils.py index 451552e..e05d907 100644 --- a/cinderclient/shell_utils.py +++ b/cinderclient/shell_utils.py @@ -26,12 +26,13 @@ _quota_resources = ['volumes', 'snapshots', 'gigabytes', _quota_infos = ['Type', 'In_use', 'Reserved', 'Limit', 'Allocated'] -def print_volume_image(image): - if 'volume_type' in image[1]['os-volume_upload_image']: - volume_type_name = ( - image[1]['os-volume_upload_image']['volume_type']['name']) - image[1]['os-volume_upload_image']['volume_type'] = volume_type_name - utils.print_dict(image[1]['os-volume_upload_image']) +def print_volume_image(image_resp_tuple): + # image_resp_tuple = tuple (response, body) + image = image_resp_tuple[1] + vt = image['os-volume_upload_image'].get('volume_type') + if vt is not None: + image['os-volume_upload_image']['volume_type'] = vt.get('name') + utils.print_dict(image['os-volume_upload_image']) def poll_for_status(poll_fn, obj_id, action, final_ok_states, |