summaryrefslogtreecommitdiff
path: root/cinderclient/shell_utils.py
diff options
context:
space:
mode:
authorEric Harney <eharney@redhat.com>2019-03-27 11:16:15 -0400
committerSean McGinnis <sean.mcginnis@gmail.com>2019-06-03 14:54:13 +0000
commit0a2bab1d4d01df99bc9594f3f055ad99584949aa (patch)
treee2176a7186cf1cf2395f8a590454985d98bbfc56 /cinderclient/shell_utils.py
parent953243daa9034e2a37114864cf0ac0b273cd0fc0 (diff)
downloadpython-cinderclient-4.2.1.tar.gz
Fix shell upload-to-image with no volume type4.2.1
Upload-to-image would error after launching the operation if the volume type is None. Closes-Bug: #1821818 Change-Id: I015e0ddfa98d62f25334e2df5effaee72a3988ab (cherry picked from commit 274fa111696783e846561d12f670967ed01ebcbc)
Diffstat (limited to 'cinderclient/shell_utils.py')
-rw-r--r--cinderclient/shell_utils.py13
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,