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
This commit is contained in:
parent
c03388e413
commit
6ed07b9320
@ -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='<VERSION>',
|
||||
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='<CONTENT_TYPE>',
|
||||
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='<VERSION>',
|
||||
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='<VERSION>',
|
||||
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='<BLOB_PROPERTY>',
|
||||
help='Name of the blob field.'
|
||||
)
|
||||
parser.add_argument(
|
||||
'--content-type',
|
||||
metavar='<CONTENT_TYPE>',
|
||||
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,
|
||||
|
@ -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}
|
||||
|
Loading…
x
Reference in New Issue
Block a user