diff options
| author | Jenkins <jenkins@review.openstack.org> | 2017-07-20 18:43:18 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2017-07-20 18:43:18 +0000 |
| commit | 57e7d9fdb33c17a96460655e46ff93bc9d19f807 (patch) | |
| tree | c37f7af24ba055b27a43585aa1e3f602fc446902 /openstackclient/compute | |
| parent | 64c458f0ee64db5e4aa43d52546634abe7664e52 (diff) | |
| parent | fcafd987b0143a08eff964f1e988a3aaa40ad824 (diff) | |
| download | python-openstackclient-57e7d9fdb33c17a96460655e46ff93bc9d19f807.tar.gz | |
Merge "Now OSC server create check keys in --nic"
Diffstat (limited to 'openstackclient/compute')
| -rw-r--r-- | openstackclient/compute/v2/server.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/openstackclient/compute/v2/server.py b/openstackclient/compute/v2/server.py index a991ed45..ce4191c1 100644 --- a/openstackclient/compute/v2/server.py +++ b/openstackclient/compute/v2/server.py @@ -651,12 +651,16 @@ class CreateServer(command.ShowOne): else: nic_info = {"net-id": "", "v4-fixed-ip": "", "v6-fixed-ip": "", "port-id": ""} - try: - nic_info.update(dict(kv_str.split("=", 1) - for kv_str in nic_str.split(","))) - except ValueError: - msg = _('Invalid --nic argument %s.') % nic_str - raise exceptions.CommandError(msg) + for kv_str in nic_str.split(","): + k, sep, v = kv_str.partition("=") + if k in nic_info and v: + nic_info[k] = v + else: + msg = (_("Invalid nic argument '%s'. Nic arguments " + "must be of the form --nic <net-id=net-uuid" + ",v4-fixed-ip=ip-addr,v6-fixed-ip=ip-addr," + "port-id=port-uuid>.")) + raise exceptions.CommandError(msg % k) if bool(nic_info["net-id"]) == bool(nic_info["port-id"]): msg = _("either network or port should be specified " "but not both") |
