summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAssaf Muller <amuller@redhat.com>2014-07-21 16:37:23 +0300
committerAssaf Muller <amuller@redhat.com>2014-08-26 19:50:01 +0000
commitdeb850b7282995d7e3b31210c177a2661578765b (patch)
treef2071f5b83da8e3c254cd96e2e927051d8ca8fba
parent155d325c7b88a8d246e4087078c8023512882462 (diff)
downloadpython-neutronclient-deb850b7282995d7e3b31210c177a2661578765b.tar.gz
Fix CLI support for DVR, take 2
Previously --distributed was displayed as positional argument in the help text, but acted as an optional argument with the -- semantics. It now behaves like any other optional argument. A side-effect is that previously you could: 1) neutron router-create --distributed r1 2) neutron router-create --distributed=True r1 3) neutron router-create --distributed=False r1 While now only options 2 and 3 are viable. DocImpact Partially-implements: blueprint neutron-ovs-dvr Closes-Bug: #1346121 Change-Id: I60675b4f60fe8154af4ab6d8f0e93867cf362a59
-rw-r--r--neutronclient/neutron/v2_0/router.py7
-rw-r--r--neutronclient/tests/unit/test_cli20_router.py7
2 files changed, 9 insertions, 5 deletions
diff --git a/neutronclient/neutron/v2_0/router.py b/neutronclient/neutron/v2_0/router.py
index 758e3a0..5d03877 100644
--- a/neutronclient/neutron/v2_0/router.py
+++ b/neutronclient/neutron/v2_0/router.py
@@ -66,13 +66,16 @@ class CreateRouter(neutronV20.CreateCommand):
'name', metavar='NAME',
help=_('Name of router to create.'))
parser.add_argument(
- 'distributed', action='store_true',
+ '--distributed',
+ dest='distributed',
+ choices=['True', 'False'],
+ default=argparse.SUPPRESS,
help=_('Create a distributed router.'))
def args2body(self, parsed_args):
body = {self.resource: {'admin_state_up': parsed_args.admin_state}}
neutronV20.update_dict(parsed_args, body[self.resource],
- ['name', 'tenant_id'])
+ ['name', 'tenant_id', 'distributed'])
return body
diff --git a/neutronclient/tests/unit/test_cli20_router.py b/neutronclient/tests/unit/test_cli20_router.py
index 274819c..372c15f 100644
--- a/neutronclient/tests/unit/test_cli20_router.py
+++ b/neutronclient/tests/unit/test_cli20_router.py
@@ -61,17 +61,18 @@ class CLITestV20RouterJSON(test_cli20.CLITestV20Base):
admin_state_up=False)
def test_create_router_distributed(self):
- """Create router: --distributed myname."""
+ """Create router: --distributed=True myname."""
resource = 'router'
cmd = router.CreateRouter(test_cli20.MyApp(sys.stdout), None)
name = 'myname'
myid = 'myid'
- args = ['--distributed', name, ]
+ distributed = 'True'
+ args = ['--distributed', distributed, name, ]
position_names = ['name', ]
position_values = [name, ]
self._test_create_resource(resource, cmd, name, myid, args,
position_names, position_values,
- distributed=True)
+ distributed=distributed)
def test_list_routers_detail(self):
"""list routers: -D."""