summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbhishek Kekane <abhishek.kekane@nttdata.com>2017-08-18 12:52:53 +0530
committerBrian Rosmaita <rosmaita.fossdev@gmail.com>2017-08-24 20:03:42 +0000
commit13b25ff1fed908cfe7b4e719a97efd7121e3be96 (patch)
tree13c9719593e47715792cb979aafd261dc245378f
parent66d486738a4f198fca4934d6cb7db5caec0e8fd7 (diff)
downloadpython-glanceclient-13b25ff1fed908cfe7b4e719a97efd7121e3be96.tar.gz
image-create-via-import fails with ValueError
CLI image-create-via-import fails with ValueError. The reason is create command returns RequestIdWrapper object and not image and response. Further it fails with AttributeError: 'Namespace' object has no attribute 'import_method'. The reason is do_import_image() call requires 'import_method' as input which is not provided at the moment. Change-Id: Ic4c4d1f3c5d290b584840e8f9047fb53611a5748 Closes-bug: #1711511 (cherry picked from commit 335f1e944719023a887730a223353a4bdb209815)
-rw-r--r--glanceclient/v2/shell.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/glanceclient/v2/shell.py b/glanceclient/v2/shell.py
index 190244c..131e826 100644
--- a/glanceclient/v2/shell.py
+++ b/glanceclient/v2/shell.py
@@ -102,6 +102,9 @@ def do_image_create(gc, args):
'passed to the client via stdin.'))
@utils.arg('--progress', action='store_true', default=False,
help=_('Show upload progress bar.'))
+@utils.arg('--import-method', metavar='<METHOD>', default='glance-direct',
+ help=_('Import method used for Image Import workflow. '
+ 'Valid values can be retrieved with import-info command.'))
@utils.on_data_require_fields(DATA_FIELDS)
def do_image_create_via_import(gc, args):
"""EXPERIMENTAL: Create a new image via image import."""
@@ -126,7 +129,7 @@ def do_image_create_via_import(gc, args):
'glance-direct' not in import_methods.get('value')):
utils.exit("No suitable import method available for direct upload, "
"please use image-create instead.")
- image, resp = gc.images.create(**fields)
+ image = gc.images.create(**fields)
try:
if utils.get_data_file(args) is not None:
args.id = image['id']