summaryrefslogtreecommitdiff
path: root/glanceclient/v1
diff options
context:
space:
mode:
authorGorka Eguileor <geguileo@redhat.com>2015-03-13 17:47:09 +0100
committerFlavio Percoco <flaper87@gmail.com>2015-08-14 09:59:17 +0200
commit8d118ccedc7e0544ec21e1fbb7f1b8b3a4f03715 (patch)
tree4819daa93f08059f267604931a17c482f6a18498 /glanceclient/v1
parent13af69039671d842167cb66e25b0dfbd1ce89724 (diff)
downloadpython-glanceclient-8d118ccedc7e0544ec21e1fbb7f1b8b3a4f03715.tar.gz
Require disk and container format on image-create
Currently glanceclient doesn't enforce disk-format or container-format presence in the command line on image-create when providing image data (with --file, --location, --copy-from), which means that the POST request is made with the whole image and error is reported by Glance API. This post enforces presence of those arguments when image data is provided so we can get the error quicker and avoid sending unnecessary data over the network. Change-Id: I5914fa9cfef190a028b374005adbf3a804b1b677 Closes-Bug: #1309272
Diffstat (limited to 'glanceclient/v1')
-rw-r--r--glanceclient/v1/shell.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/glanceclient/v1/shell.py b/glanceclient/v1/shell.py
index 83b8576..c28dc23 100644
--- a/glanceclient/v1/shell.py
+++ b/glanceclient/v1/shell.py
@@ -32,6 +32,7 @@ import glanceclient.v1.images
CONTAINER_FORMATS = 'Acceptable formats: ami, ari, aki, bare, and ovf.'
DISK_FORMATS = ('Acceptable formats: ami, ari, aki, vhd, vmdk, raw, '
'qcow2, vdi, and iso.')
+DATA_FIELDS = ('location', 'copy_from', 'file')
_bool_strict = functools.partial(strutils.bool_from_string, strict=True)
@@ -221,6 +222,7 @@ def do_image_download(gc, args):
help='Print image size in a human-friendly format.')
@utils.arg('--progress', action='store_true', default=False,
help='Show upload progress bar.')
+@utils.on_data_require_fields(DATA_FIELDS)
def do_image_create(gc, args):
"""Create a new image."""
# Filter out None values