Merge "OSC: Add --labels to coe cluster create"

This commit is contained in:
Zuul 2017-10-02 19:16:54 +00:00 committed by Gerrit Code Review
commit 8a39691c10
3 changed files with 14 additions and 0 deletions

View File

@ -32,6 +32,7 @@ CLUSTER_ATTRIBUTES = [
'created_at',
'updated_at',
'coe_version',
'labels',
'faults',
'keypair',
'api_address',
@ -68,6 +69,13 @@ class CreateCluster(command.Command):
metavar='<docker-volume-size>',
help=('The size in GB for the docker volume to '
'use.'))
parser.add_argument('--labels',
metavar='<KEY1=VALUE1,KEY2=VALUE2;KEY3=VALUE3...>',
action='append',
default=[],
help=_('Arbitrary labels in the form of key=value'
'pairs to associate with a cluster '
'template. May be used multiple times.'))
parser.add_argument('--keypair',
default=None,
metavar='<keypair>',
@ -110,6 +118,10 @@ class CreateCluster(command.Command):
'name': parsed_args.name,
'node_count': parsed_args.node_count,
}
if parsed_args.labels is not None:
args['labels'] = magnum_utils.handle_labels(parsed_args.labels)
cluster = mag_client.clusters.create(**args)
print("Request to create cluster %s accepted"
% cluster.uuid)

View File

@ -187,6 +187,7 @@ class FakeCluster(object):
'uuid': '3a369884-b6ba-484f-a206-919b4b718aff',
'stack_id': 'c4554582-77bd-4734-8f1a-72c3c40e5fb4',
'status_reason': None,
'labels': {},
'created_at': '2017-03-16T18:40:39+00:00',
'updated_at': '2017-03-16T18:40:45+00:00',
'coe_version': None,

View File

@ -43,6 +43,7 @@ class TestClusterCreate(TestCluster):
'create_timeout': 60,
'discovery_url': None,
'docker_volume_size': None,
'labels': {},
'keypair': None,
'master_count': 1,
'name': None,