Merge "Add hidden property to cluster template"
This commit is contained in:
commit
c79d673096
@ -51,7 +51,8 @@ CLUSTER_TEMPLATE_ATTRIBUTES = [
|
||||
'coe',
|
||||
'flavor_id',
|
||||
'master_lb_enabled',
|
||||
'dns_nameserver'
|
||||
'dns_nameserver',
|
||||
'hidden'
|
||||
]
|
||||
|
||||
|
||||
@ -221,6 +222,17 @@ class CreateClusterTemplate(command.ShowOne):
|
||||
action='append_const',
|
||||
const=False,
|
||||
help=_('Disables floating ip creation on the new Cluster'))
|
||||
parser.add_argument(
|
||||
'--hidden',
|
||||
dest='hidden',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help=_('Indicates the cluster template should be hidden.'))
|
||||
parser.add_argument(
|
||||
'--visible',
|
||||
dest='hidden',
|
||||
action='store_false',
|
||||
help=_('Indicates the cluster template should be visible.'))
|
||||
|
||||
return parser
|
||||
|
||||
@ -251,6 +263,7 @@ class CreateClusterTemplate(command.ShowOne):
|
||||
'registry_enabled': parsed_args.registry_enabled,
|
||||
'server_type': parsed_args.server_type,
|
||||
'master_lb_enabled': parsed_args.master_lb_enabled,
|
||||
'hidden': parsed_args.hidden
|
||||
}
|
||||
if len(parsed_args.floating_ip_enabled) > 1:
|
||||
raise InvalidAttribute('--floating-ip-enabled and '
|
||||
|
@ -165,7 +165,8 @@ class FakeClusterTemplate(object):
|
||||
'coe': 'kubernetes',
|
||||
'flavor_id': 'm1.medium',
|
||||
'master_lb_enabled': False,
|
||||
'dns_nameserver': '8.8.8.8'
|
||||
'dns_nameserver': '8.8.8.8',
|
||||
'hidden': False
|
||||
}
|
||||
|
||||
# Overwrite default attributes.
|
||||
|
@ -48,7 +48,8 @@ class TestClusterTemplate(magnum_fakes.TestMagnumClientOSCV1):
|
||||
'registry_enabled': False,
|
||||
'server_type': 'vm',
|
||||
'tls_disabled': False,
|
||||
'volume_driver': None
|
||||
'volume_driver': None,
|
||||
'hidden': False
|
||||
}
|
||||
|
||||
def setUp(self):
|
||||
|
@ -46,7 +46,8 @@ CLUSTERTEMPLATE1 = {
|
||||
'public': False,
|
||||
'registry_enabled': False,
|
||||
'master_lb_enabled': True,
|
||||
'floating_ip_enabled': True
|
||||
'floating_ip_enabled': True,
|
||||
'hidden': False
|
||||
}
|
||||
|
||||
CLUSTERTEMPLATE2 = {
|
||||
@ -309,6 +310,8 @@ class ClusterTemplateManagerTest(testtools.TestCase):
|
||||
cluster_template.master_lb_enabled)
|
||||
self.assertEqual(CLUSTERTEMPLATE1['floating_ip_enabled'],
|
||||
cluster_template.floating_ip_enabled)
|
||||
self.assertEqual(CLUSTERTEMPLATE1['hidden'],
|
||||
cluster_template.hidden)
|
||||
|
||||
def test_clustertemplate_show_by_name(self):
|
||||
cluster_template = self.mgr.get(CLUSTERTEMPLATE1['name'])
|
||||
@ -355,6 +358,8 @@ class ClusterTemplateManagerTest(testtools.TestCase):
|
||||
cluster_template.master_lb_enabled)
|
||||
self.assertEqual(CLUSTERTEMPLATE1['floating_ip_enabled'],
|
||||
cluster_template.floating_ip_enabled)
|
||||
self.assertEqual(CLUSTERTEMPLATE1['hidden'],
|
||||
cluster_template.hidden)
|
||||
|
||||
def test_clustertemplate_create(self):
|
||||
cluster_template = self.mgr.create(**CREATE_CLUSTERTEMPLATE)
|
||||
|
@ -32,6 +32,7 @@ class FakeClusterTemplate(ClusterTemplate):
|
||||
self.coe = kwargs.get('coe', 'x')
|
||||
self.public = kwargs.get('public', False)
|
||||
self.name = kwargs.get('name', 'x')
|
||||
self.hidden = kwargs.get('hidden', False)
|
||||
|
||||
|
||||
class ShellTest(shell_test_base.TestCommandLineArgument):
|
||||
@ -58,7 +59,7 @@ class ShellTest(shell_test_base.TestCommandLineArgument):
|
||||
tls_disabled=False, public=False,
|
||||
master_lb_enabled=False, server_type='vm',
|
||||
registry_enabled=False,
|
||||
insecure_registry=None):
|
||||
insecure_registry=None, hidden=False):
|
||||
|
||||
expected_args = {}
|
||||
expected_args['image_id'] = image_id
|
||||
@ -85,6 +86,7 @@ class ShellTest(shell_test_base.TestCommandLineArgument):
|
||||
expected_args['server_type'] = server_type
|
||||
expected_args['registry_enabled'] = registry_enabled
|
||||
expected_args['insecure_registry'] = insecure_registry
|
||||
expected_args['hidden'] = hidden
|
||||
|
||||
return expected_args
|
||||
|
||||
|
@ -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']
|
||||
'floating_ip_enabled', 'hidden']
|
||||
|
||||
OUTPUT_ATTRIBUTES = CREATION_ATTRIBUTES + ['apiserver_port', 'created_at',
|
||||
'insecure_registry', 'links',
|
||||
|
@ -187,6 +187,13 @@ def _show_cluster_template(cluster_template):
|
||||
@utils.arg('--insecure-registry',
|
||||
metavar='<insecure-registry>',
|
||||
help='url of docker registry')
|
||||
@utils.arg('--hidden',
|
||||
action='store_true', default=False,
|
||||
help=_('Make cluster template hidden.'))
|
||||
@utils.arg('--visible',
|
||||
dest='hidden',
|
||||
action='store_false',
|
||||
help=_('Make cluster template visible.'))
|
||||
@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
|
||||
def do_cluster_template_create(cs, args):
|
||||
"""Create a cluster template."""
|
||||
@ -219,6 +226,7 @@ def do_cluster_template_create(cs, args):
|
||||
opts['server_type'] = args.server_type
|
||||
opts['master_lb_enabled'] = args.master_lb_enabled
|
||||
opts['insecure_registry'] = args.insecure_registry
|
||||
opts['hidden'] = args.hidden
|
||||
|
||||
if len(args.floating_ip_enabled) > 1:
|
||||
raise InvalidAttribute('--floating-ip-enabled and '
|
||||
|
Loading…
Reference in New Issue
Block a user