From 6ed07b932080b42fdb69e6c4dacb0eb82450a915 Mon Sep 17 00:00:00 2001 From: Mike Fedosin Date: Wed, 28 Dec 2016 15:06:31 +0300 Subject: [PATCH] Update CLI options for blobs This patch * changes artifact version option from -v to -V for all blob commands * adds option -C for setting custom content-type for blob uploading * removes unnecessary possibility for setting content-type for external locations Change-Id: I2f51ce588db3f88d9309081a3d52541a45746d88 --- glareclient/osc/v1/blobs.py | 17 +++++------------ glareclient/v1/artifacts.py | 5 ++--- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/glareclient/osc/v1/blobs.py b/glareclient/osc/v1/blobs.py index 06c42fc..14b0923 100644 --- a/glareclient/osc/v1/blobs.py +++ b/glareclient/osc/v1/blobs.py @@ -65,7 +65,7 @@ class UploadBlob(command.ShowOne): help='Name or id of the artifact to upload.', ), parser.add_argument( - '--artifact-version', '-v', + '--artifact-version', '-V', metavar='', default='latest', help='Version of the artifact.', @@ -86,7 +86,7 @@ class UploadBlob(command.ShowOne): help='Name of the blob field.' ) parser.add_argument( - '--content-type', + '--content-type', '-C', metavar='', default='application/octet-stream', help='Content-type of the blob.' @@ -141,7 +141,7 @@ class DownloadBlob(command.Command): help='Name or id of the artifact to download.', ), parser.add_argument( - '--artifact-version', '-v', + '--artifact-version', '-V', metavar='', default='latest', help='Version of the artifact.', @@ -209,7 +209,7 @@ class AddLocation(command.ShowOne): help='Name or id of the artifact to download.', ), parser.add_argument( - '--artifact-version', '-v', + '--artifact-version', '-V', metavar='', default='latest', help='Version of the artifact.', @@ -240,16 +240,10 @@ class AddLocation(command.ShowOne): help='Specify a checksum sha256.', ) parser.add_argument( - '--blob-property', + '--blob-property', '-p', metavar='', help='Name of the blob field.' ) - parser.add_argument( - '--content-type', - metavar='', - default='application/vnd+openstack.glare-custom-location+json', - help='Content-type of the blob.' - ) return parser def take_action(self, parsed_args): @@ -272,7 +266,6 @@ class AddLocation(command.ShowOne): af_id, parsed_args.blob_property, data, - content_type=parsed_args.content_type, type_name=parsed_args.type_name) data = client.artifacts.get(af_id, diff --git a/glareclient/v1/artifacts.py b/glareclient/v1/artifacts.py index 0dc128a..f1a814a 100644 --- a/glareclient/v1/artifacts.py +++ b/glareclient/v1/artifacts.py @@ -229,14 +229,13 @@ class Controller(object): self.http_client.put(url, headers=hdrs, data=data, stream=True) def add_external_location(self, artifact_id, blob_property, data, - type_name=None, content_type=None): + type_name=None): """Add external location. :param artifact_id: ID of the artifact to download a blob :param blob_property: blob property name """ - content_type = (content_type or - 'application/vnd+openstack.glare-custom-location+json') + content_type = 'application/vnd+openstack.glare-custom-location+json' type_name = self._check_type_name(type_name) hdrs = {'Content-Type': content_type}