Add CT tags argument and field to client
We noticed that from the user perspective it is hard to know when a cluster_template provided by the cloud admin is mature enough for a production release. This field will allow the administrator to add an annotation to the cluster template like {deprecated, recommended, testing} giving further usefull information to the end user about the template's life cycle This patch allows the magnumclient to pass the --tags <text> when creating a cluster template and also shows the observations available when listing existent cluster templates. story: 2004215 task: 40161 Depends-On: I5d1c4221f089bc5cd12b25f620aa01771a029df9 Change-Id: Ibbdc9a9cd7ae4733eb6d38a7db11a68866f0d446 Signed-off-by: Diogo Guerra <dy090.guerra@gmail.com>
This commit is contained in:
parent
0799acf939
commit
201b3527b0
@ -52,7 +52,8 @@ CLUSTER_TEMPLATE_ATTRIBUTES = [
|
||||
'flavor_id',
|
||||
'master_lb_enabled',
|
||||
'dns_nameserver',
|
||||
'hidden'
|
||||
'hidden',
|
||||
'tags',
|
||||
]
|
||||
|
||||
|
||||
@ -233,6 +234,12 @@ class CreateClusterTemplate(command.ShowOne):
|
||||
dest='hidden',
|
||||
action='store_false',
|
||||
help=_('Indicates the cluster template should be visible.'))
|
||||
parser.add_argument(
|
||||
'--tags',
|
||||
action='append',
|
||||
default=[],
|
||||
metavar='<--tags tag1 --tags tag2,tag3>',
|
||||
help=_('Tags to be added to the cluster template.'))
|
||||
|
||||
return parser
|
||||
|
||||
@ -265,10 +272,12 @@ class CreateClusterTemplate(command.ShowOne):
|
||||
'master_lb_enabled': parsed_args.master_lb_enabled,
|
||||
}
|
||||
|
||||
# NOTE (brtknr): Only supply hidden arg if it is True
|
||||
# for backward compatibility
|
||||
# NOTE: Make new arguments backward compatible
|
||||
if parsed_args.hidden:
|
||||
args['hidden'] = parsed_args.hidden
|
||||
if parsed_args.tags:
|
||||
args['tags'] = ','.join(set(
|
||||
(','.join(parsed_args.tags)).split(',')))
|
||||
|
||||
if len(parsed_args.floating_ip_enabled) > 1:
|
||||
raise InvalidAttribute('--floating-ip-enabled and '
|
||||
@ -359,7 +368,7 @@ class ListTemplateCluster(command.Lister):
|
||||
self.log.debug("take_action(%s)", parsed_args)
|
||||
|
||||
mag_client = self.app.client_manager.container_infra
|
||||
columns = ['uuid', 'name']
|
||||
columns = ['uuid', 'name', 'tags']
|
||||
if parsed_args.fields:
|
||||
columns += parsed_args.fields.split(',')
|
||||
cts = mag_client.cluster_templates.list(limit=parsed_args.limit,
|
||||
|
@ -185,7 +185,8 @@ class FakeClusterTemplate(object):
|
||||
'flavor_id': 'm1.medium',
|
||||
'master_lb_enabled': False,
|
||||
'dns_nameserver': '8.8.8.8',
|
||||
'hidden': False
|
||||
'hidden': False,
|
||||
'tags': "",
|
||||
}
|
||||
|
||||
# Overwrite default attributes.
|
||||
|
@ -225,12 +225,15 @@ class TestClusterTemplateList(TestClusterTemplate):
|
||||
|
||||
columns = [
|
||||
'uuid',
|
||||
'name'
|
||||
'name',
|
||||
'tags',
|
||||
]
|
||||
|
||||
datalist = (
|
||||
(_cluster_template.uuid, _cluster_template.name),
|
||||
(_cluster_template2.uuid, _cluster_template2.name)
|
||||
(_cluster_template.uuid, _cluster_template.name,
|
||||
_cluster_template.tags),
|
||||
(_cluster_template2.uuid, _cluster_template2.name,
|
||||
_cluster_template.tags)
|
||||
)
|
||||
|
||||
def setUp(self):
|
||||
|
@ -22,7 +22,7 @@ CREATION_ATTRIBUTES = ['name', 'image_id', 'flavor_id', 'master_flavor_id',
|
||||
'no_proxy', 'network_driver', 'tls_disabled', 'public',
|
||||
'registry_enabled', 'volume_driver', 'server_type',
|
||||
'docker_storage_driver', 'master_lb_enabled',
|
||||
'floating_ip_enabled', 'hidden']
|
||||
'floating_ip_enabled', 'hidden', 'tags']
|
||||
|
||||
OUTPUT_ATTRIBUTES = CREATION_ATTRIBUTES + ['apiserver_port', 'created_at',
|
||||
'insecure_registry', 'links',
|
||||
|
@ -0,0 +1,9 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
When creating a cluster template the administrator can
|
||||
use --tags <text> argument to add any information
|
||||
that he considers important. The received text is a
|
||||
comma separated list with the pretended tags.
|
||||
This information is also shown when the user lists all
|
||||
the available cluster templates.
|
Loading…
Reference in New Issue
Block a user