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
This commit is contained in:
Matthew Farrellee
2014-01-27 20:06:01 -05:00
parent ad8d03c013
commit fd777f1d2c

View File

@@ -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: