Add an optional parameter --append

This patch will add an optional parameter --append to the glanceclient
command md-tag-create-multiple to provide the facility of appending
the tags.
If the parameter is present  it will append the tags to existing one,
else it will overwrite the existing tags.

Depends-On: https://review.opendev.org/c/openstack/glance/+/804966
Change-Id: I1841e7146da76b13f4cd8925e19f59d0eaf08f7a
This commit is contained in:
Mridula Joshi
2021-10-12 07:32:36 +00:00
parent 8aac1597cd
commit b8863535a8
3 changed files with 35 additions and 8 deletions
+4 -2
View File
@@ -1383,10 +1383,12 @@ def do_md_tag_create(gc, args):
@utils.arg('--delim', metavar='<DELIM>', required=False,
help=_('The delimiter used to separate the names'
' (if none is provided then the default is a comma).'))
@utils.arg('--append', default=False, action='store_true', required=False,
help=_('Append the new tags to the existing ones instead of'
'overwriting them'))
def do_md_tag_create_multiple(gc, args):
"""Create new metadata definitions tags inside a namespace."""
delim = args.delim or ','
tags = []
names_list = args.names.split(delim)
for name in names_list:
@@ -1398,7 +1400,7 @@ def do_md_tag_create_multiple(gc, args):
utils.exit('Please supply at least one tag name. For example: '
'--names Tag1')
fields = {'tags': tags}
fields = {'tags': tags, 'append': args.append}
new_tags = gc.metadefs_tag.create_multiple(args.namespace, **fields)
columns = ['name']
column_settings = {