Add cluster-scale command to the CLI

Cluster scaling is supported in the API but is not exposed in the client shell.
It should be added.

Change-Id: I319b75f628c48b8d4ecee9ca05b7dd54d15296df
Closes-bug: 1446370
This commit is contained in:
Li, Chen
2015-07-23 16:07:50 +08:00
parent 2ba5ca3ed9
commit dbbdcdc635

View File

@@ -277,7 +277,7 @@ def do_image_remove_tag(cs, args):
#
# cluster-create [--json <file>]
#
# TODO(mattf): cluster-scale
# cluster-scale --name <cluster>|--id <cluster_id> [--json <file>]
#
# cluster-delete --name <cluster>|--id <cluster_id>
#
@@ -331,6 +331,22 @@ def do_cluster_create(cs, args):
_show_cluster(cs.clusters.create(**template))
@utils.arg('--name',
help='Name of the cluster.')
@utils.arg('--id',
metavar='<cluster_id>',
help='ID of the cluster.')
@utils.arg('--json',
default=sys.stdin,
type=argparse.FileType('r'),
help='JSON representation of cluster scale.')
def do_cluster_scale(cs, args):
"""Scale a cluster """
cluster_id = args.id or _get_by_id_or_name(cs.clusters, name=args.name).id
scale_template = json.loads(args.json.read())
_show_cluster(cs.clusters.scale(cluster_id, **scale_template))
@utils.arg('--name',
help='Name of the cluster.')
@utils.arg('--id',