summaryrefslogtreecommitdiff
path: root/novaclient/v2/shell.py
diff options
context:
space:
mode:
authorDan Smith <dansmith@redhat.com>2017-03-17 07:11:38 -0700
committerMatt Riedemann <mriedem.os@gmail.com>2017-10-03 20:43:47 +0000
commit41aeb89cae68a0e2ce03a248226488d4ba2ea8af (patch)
treef96eab93bd2efa38a78455d00dada8940c115021 /novaclient/v2/shell.py
parent5620beb7c8d3ff6a30ddef2140ae3aa1fbde6a98 (diff)
downloadpython-novaclient-6.0.2.tar.gz
Fix aggregate_update name and availability_zone clashnewton-eol6.0.2stable/newton
The name and availability_zone arguments to aggregate update were replaced by optional parameters in change I778ab7ec54a376c60f19dcc89fe62fcab6e59e42. However, the '--name' and 'name' arguments in the parser would conflict, resulting in only the deprecated argument working. Thus, attempting to update the name on an aggregate using --name would end up doing a PUT with no new name provided. Note that there were unit tests for this, but they were not catching this problem. So, this removes those tests and adds functional tests to poke it. Change-Id: Ifef6fdc1a737dd219712a4525d4e34afd3fbd80c Closes-Bug: #1673789 (cherry picked from commit 20f00553d0d8ed791105d5f7fc8798b9ac6a6a53) (cherry picked from commit 983f7211a872a5be9698d7c57fda41020765a64a)
Diffstat (limited to 'novaclient/v2/shell.py')
-rw-r--r--novaclient/v2/shell.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/novaclient/v2/shell.py b/novaclient/v2/shell.py
index 36f0080c..ad902461 100644
--- a/novaclient/v2/shell.py
+++ b/novaclient/v2/shell.py
@@ -3733,7 +3733,8 @@ def do_aggregate_delete(cs, args):
metavar='<aggregate>',
help=_('Name or ID of aggregate to update.'))
@utils.arg(
- 'name',
+ 'old_name',
+ metavar='<name>',
nargs='?',
action=shell.DeprecatedAction,
use=_('use "%s"; this option will be removed in '
@@ -3744,7 +3745,7 @@ def do_aggregate_delete(cs, args):
dest='name',
help=_('Name of aggregate.'))
@utils.arg(
- 'availability_zone',
+ 'old_availability_zone',
metavar='<availability-zone>',
nargs='?',
default=None,
@@ -3761,10 +3762,11 @@ def do_aggregate_update(cs, args):
"""Update the aggregate's name and optionally availability zone."""
aggregate = _find_aggregate(cs, args.aggregate)
updates = {}
- if args.name:
- updates["name"] = args.name
- if args.availability_zone:
- updates["availability_zone"] = args.availability_zone
+ if args.name or args.old_name:
+ updates["name"] = args.name or args.old_name
+ if args.availability_zone or args.old_availability_zone:
+ updates["availability_zone"] = (args.availability_zone or
+ args.old_availability_zone)
aggregate = cs.aggregates.update(aggregate.id, updates)
print(_("Aggregate %s has been successfully updated.") % aggregate.id)