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',
|
'flavor_id',
|
||||||
'master_lb_enabled',
|
'master_lb_enabled',
|
||||||
'dns_nameserver',
|
'dns_nameserver',
|
||||||
'hidden'
|
'hidden',
|
||||||
|
'tags',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@ -233,6 +234,12 @@ class CreateClusterTemplate(command.ShowOne):
|
|||||||
dest='hidden',
|
dest='hidden',
|
||||||
action='store_false',
|
action='store_false',
|
||||||
help=_('Indicates the cluster template should be visible.'))
|
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
|
return parser
|
||||||
|
|
||||||
@ -265,10 +272,12 @@ class CreateClusterTemplate(command.ShowOne):
|
|||||||
'master_lb_enabled': parsed_args.master_lb_enabled,
|
'master_lb_enabled': parsed_args.master_lb_enabled,
|
||||||
}
|
}
|
||||||
|
|
||||||
# NOTE (brtknr): Only supply hidden arg if it is True
|
# NOTE: Make new arguments backward compatible
|
||||||
# for backward compatibility
|
|
||||||
if parsed_args.hidden:
|
if parsed_args.hidden:
|
||||||
args['hidden'] = 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:
|
if len(parsed_args.floating_ip_enabled) > 1:
|
||||||
raise InvalidAttribute('--floating-ip-enabled and '
|
raise InvalidAttribute('--floating-ip-enabled and '
|
||||||
@ -359,7 +368,7 @@ class ListTemplateCluster(command.Lister):
|
|||||||
self.log.debug("take_action(%s)", parsed_args)
|
self.log.debug("take_action(%s)", parsed_args)
|
||||||
|
|
||||||
mag_client = self.app.client_manager.container_infra
|
mag_client = self.app.client_manager.container_infra
|
||||||
columns = ['uuid', 'name']
|
columns = ['uuid', 'name', 'tags']
|
||||||
if parsed_args.fields:
|
if parsed_args.fields:
|
||||||
columns += parsed_args.fields.split(',')
|
columns += parsed_args.fields.split(',')
|
||||||
cts = mag_client.cluster_templates.list(limit=parsed_args.limit,
|
cts = mag_client.cluster_templates.list(limit=parsed_args.limit,
|
||||||
|
@ -185,7 +185,8 @@ class FakeClusterTemplate(object):
|
|||||||
'flavor_id': 'm1.medium',
|
'flavor_id': 'm1.medium',
|
||||||
'master_lb_enabled': False,
|
'master_lb_enabled': False,
|
||||||
'dns_nameserver': '8.8.8.8',
|
'dns_nameserver': '8.8.8.8',
|
||||||
'hidden': False
|
'hidden': False,
|
||||||
|
'tags': "",
|
||||||
}
|
}
|
||||||
|
|
||||||
# Overwrite default attributes.
|
# Overwrite default attributes.
|
||||||
|
@ -225,12 +225,15 @@ class TestClusterTemplateList(TestClusterTemplate):
|
|||||||
|
|
||||||
columns = [
|
columns = [
|
||||||
'uuid',
|
'uuid',
|
||||||
'name'
|
'name',
|
||||||
|
'tags',
|
||||||
]
|
]
|
||||||
|
|
||||||
datalist = (
|
datalist = (
|
||||||
(_cluster_template.uuid, _cluster_template.name),
|
(_cluster_template.uuid, _cluster_template.name,
|
||||||
(_cluster_template2.uuid, _cluster_template2.name)
|
_cluster_template.tags),
|
||||||
|
(_cluster_template2.uuid, _cluster_template2.name,
|
||||||
|
_cluster_template.tags)
|
||||||
)
|
)
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -22,7 +22,7 @@ CREATION_ATTRIBUTES = ['name', 'image_id', 'flavor_id', 'master_flavor_id',
|
|||||||
'no_proxy', 'network_driver', 'tls_disabled', 'public',
|
'no_proxy', 'network_driver', 'tls_disabled', 'public',
|
||||||
'registry_enabled', 'volume_driver', 'server_type',
|
'registry_enabled', 'volume_driver', 'server_type',
|
||||||
'docker_storage_driver', 'master_lb_enabled',
|
'docker_storage_driver', 'master_lb_enabled',
|
||||||
'floating_ip_enabled', 'hidden']
|
'floating_ip_enabled', 'hidden', 'tags']
|
||||||
|
|
||||||
OUTPUT_ATTRIBUTES = CREATION_ATTRIBUTES + ['apiserver_port', 'created_at',
|
OUTPUT_ATTRIBUTES = CREATION_ATTRIBUTES + ['apiserver_port', 'created_at',
|
||||||
'insecure_registry', 'links',
|
'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