From fd777f1d2c219cc2e4adaf9b08d7b05be806a69a Mon Sep 17 00:00:00 2001 From: Matthew Farrellee Date: Mon, 27 Jan 2014 20:06:01 -0500 Subject: [PATCH] Map neutron_management_network to net_id in CLI The JSON representation of a cluster uses neutron_management_network as a property name. The CLI allows for JSON injest, which is then translated into a ClusterManager.create call. The injest maps property names to parameter names to ClusterManager.create. This works in all cases except neutron_management_network, which is the net_id parameter to create. To address this, the CLI accepts neutron_management_network and maps it to the net_id parameter. Change-Id: I69799d0108740f0e79c82e45714fd946e9a2a4b0 Closes-bug: #1273500 --- savannaclient/api/shell.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/savannaclient/api/shell.py b/savannaclient/api/shell.py index 72e0a8b2..308b1cba 100644 --- a/savannaclient/api/shell.py +++ b/savannaclient/api/shell.py @@ -287,6 +287,11 @@ def do_cluster_create(cs, args): """Create a cluster.""" # TODO(mattf): improve template validation, e.g. template w/o name key template = json.loads(args.json.read()) + # The neutron_management_network parameter to clusters.create is + # called net_id. Therefore, we must translate before invoking + # create w/ **template. It may be desirable to simple change + # clusters.create in the future. + template['net_id'] = template.get('neutron_management_network', None) valid_args = inspect.getargspec(cs.clusters.create).args for name in template.keys(): if name not in valid_args: