diff options
| author | Jenkins <jenkins@review.openstack.org> | 2016-05-16 22:51:15 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2016-05-16 22:51:15 +0000 |
| commit | 11be59db8ccca812dd1c7e06b0be5a7198bd267a (patch) | |
| tree | 481e704e91c507fe57721e8ae858aa91fc15e067 /openstackclient/network | |
| parent | 22e738c751fad6b582d9bee16a13848d76b95781 (diff) | |
| parent | bc93ebfe5c0fa4d29b79fa3fd93ec603425997ea (diff) | |
| download | python-openstackclient-11be59db8ccca812dd1c7e06b0be5a7198bd267a.tar.gz | |
Merge "Added --no-route to the router set command"
Diffstat (limited to 'openstackclient/network')
| -rw-r--r-- | openstackclient/network/v2/router.py | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/openstackclient/network/v2/router.py b/openstackclient/network/v2/router.py index a32ab5ea..e479eee3 100644 --- a/openstackclient/network/v2/router.py +++ b/openstackclient/network/v2/router.py @@ -13,7 +13,9 @@ """Router action implementations""" +import argparse import json +import logging from openstackclient.common import command from openstackclient.common import exceptions @@ -23,6 +25,9 @@ from openstackclient.i18n import _ from openstackclient.identity import common as identity_common +LOG = logging.getLogger(__name__) + + def _format_admin_state(state): return 'UP' if state else 'DOWN' @@ -379,10 +384,15 @@ class SetRouter(command.Command): "(repeat option to set multiple routes)") ) routes_group.add_argument( - '--clear-routes', + '--no-route', action='store_true', help=_("Clear routes associated with the router") ) + routes_group.add_argument( + '--clear-routes', + action='store_true', + help=argparse.SUPPRESS, + ) # TODO(tangchen): Support setting 'ha' property in 'router set' # command. It appears that changing the ha state is supported by @@ -401,8 +411,14 @@ class SetRouter(command.Command): attrs = _get_attrs(self.app.client_manager, parsed_args) # Get the route attributes. - if parsed_args.clear_routes: + if parsed_args.no_route: + attrs['routes'] = [] + elif parsed_args.clear_routes: attrs['routes'] = [] + LOG.warning(_( + 'The --clear-routes option is deprecated, ' + 'please use --no-route instead.' + )) elif parsed_args.routes is not None: # Map the route keys and append to the current routes. # The REST API will handle route validation and duplicates. |
