diff options
Diffstat (limited to 'openstackclient/network')
| -rw-r--r-- | openstackclient/network/v2/port.py | 35 | ||||
| -rw-r--r-- | openstackclient/network/v2/router.py | 19 | ||||
| -rw-r--r-- | openstackclient/network/v2/security_group_rule.py | 63 |
3 files changed, 13 insertions, 104 deletions
diff --git a/openstackclient/network/v2/port.py b/openstackclient/network/v2/port.py index f6d6fc72..50bc742f 100644 --- a/openstackclient/network/v2/port.py +++ b/openstackclient/network/v2/port.py @@ -96,21 +96,6 @@ class JSONKeyValueAction(argparse.Action): def _get_attrs(client_manager, parsed_args): attrs = {} - # Handle deprecated options - # NOTE(dtroyer): --device-id and --host-id were deprecated in Mar 2016. - # Do not remove before 3.x release or Mar 2017. - if parsed_args.device_id: - attrs['device_id'] = parsed_args.device_id - LOG.warning(_( - 'The --device-id option is deprecated, ' - 'please use --device instead.' - )) - if parsed_args.host_id: - attrs['binding:host_id'] = parsed_args.host_id - LOG.warning(_( - 'The --host-id option is deprecated, ' - 'please use --host instead.' - )) if parsed_args.description is not None: attrs['description'] = parsed_args.description if parsed_args.device: @@ -235,19 +220,11 @@ def _add_updatable_args(parser): metavar='<description>', help=_("Description of this port") ) - # NOTE(dtroyer): --device-id is deprecated in Mar 2016. Do not - # remove before 3.x release or Mar 2017. - device_group = parser.add_mutually_exclusive_group() - device_group.add_argument( + parser.add_argument( '--device', metavar='<device-id>', help=_("Port device ID") ) - device_group.add_argument( - '--device-id', - metavar='<device-id>', - help=argparse.SUPPRESS, - ) parser.add_argument( '--mac-address', metavar='<mac-address>', @@ -268,19 +245,11 @@ def _add_updatable_args(parser): "macvtap | normal | baremetal | virtio-forwarder, " "default: normal)") ) - # NOTE(dtroyer): --host-id is deprecated in Mar 2016. Do not - # remove before 3.x release or Mar 2017. - host_group = parser.add_mutually_exclusive_group() - host_group.add_argument( + parser.add_argument( '--host', metavar='<host-id>', help=_("Allocate port on host <host-id> (ID only)") ) - host_group.add_argument( - '--host-id', - metavar='<host-id>', - help=argparse.SUPPRESS, - ) parser.add_argument( '--dns-domain', metavar='dns-domain', diff --git a/openstackclient/network/v2/router.py b/openstackclient/network/v2/router.py index 2ec3e2f0..13de66aa 100644 --- a/openstackclient/network/v2/router.py +++ b/openstackclient/network/v2/router.py @@ -13,7 +13,6 @@ """Router action implementations""" -import argparse import copy import json import logging @@ -528,8 +527,6 @@ class SetRouter(command.Command): action='store_true', help=_("Set router to centralized mode (disabled router only)") ) - routes_group = parser.add_mutually_exclusive_group() - # ToDo(Reedip):Remove mutual exclusiveness once clear-routes is removed parser.add_argument( '--route', metavar='destination=<subnet>,gateway=<ip-address>', @@ -542,18 +539,13 @@ class SetRouter(command.Command): "gateway: nexthop IP address " "(repeat option to set multiple routes)") ) - routes_group.add_argument( + parser.add_argument( '--no-route', action='store_true', help=_("Clear routes associated with the router. " "Specify both --route and --no-route to overwrite " "current value of route.") ) - routes_group.add_argument( - '--clear-routes', - action='store_true', - help=argparse.SUPPRESS, - ) routes_ha = parser.add_mutually_exclusive_group() routes_ha.add_argument( '--ha', @@ -619,21 +611,16 @@ class SetRouter(command.Command): attrs['ha'] = True elif parsed_args.no_ha: attrs['ha'] = False - if parsed_args.clear_routes: - LOG.warning(_( - 'The --clear-routes option is deprecated, ' - 'please use --no-route instead.' - )) if parsed_args.routes is not None: for route in parsed_args.routes: route['nexthop'] = route.pop('gateway') attrs['routes'] = parsed_args.routes - if not (parsed_args.no_route or parsed_args.clear_routes): + if not parsed_args.no_route: # Map the route keys and append to the current routes. # The REST API will handle route validation and duplicates. attrs['routes'] += obj.routes - elif parsed_args.no_route or parsed_args.clear_routes: + elif parsed_args.no_route: attrs['routes'] = [] if (parsed_args.disable_snat or parsed_args.enable_snat or parsed_args.fixed_ip) and not parsed_args.external_gateway: diff --git a/openstackclient/network/v2/security_group_rule.py b/openstackclient/network/v2/security_group_rule.py index 961125a9..df19af20 100644 --- a/openstackclient/network/v2/security_group_rule.py +++ b/openstackclient/network/v2/security_group_rule.py @@ -115,19 +115,6 @@ class CreateSecurityGroupRule(common.NetworkAndComputeShowOne): metavar="<group>", help=_("Remote security group (name or ID)"), ) - # Handle deprecated options - # NOTE(dtroyer): --src-ip and --src-group were deprecated in Nov 2016. - # Do not remove before 4.x release or Nov 2017. - remote_group.add_argument( - "--src-ip", - metavar="<ip-address>", - help=argparse.SUPPRESS, - ) - remote_group.add_argument( - "--src-group", - metavar="<group>", - help=argparse.SUPPRESS, - ) return parser def update_parser_network(self, parser): @@ -310,31 +297,13 @@ class CreateSecurityGroupRule(common.NetworkAndComputeShowOne): if parsed_args.icmp_code is not None and parsed_args.icmp_code >= 0: attrs['port_range_max'] = parsed_args.icmp_code - # NOTE(dtroyer): --src-ip and --src-group were deprecated in Nov 2016. - # Do not remove before 4.x release or Nov 2017. - if not (parsed_args.remote_group is None and - parsed_args.src_group is None): + if parsed_args.remote_group is not None: attrs['remote_group_id'] = client.find_security_group( - parsed_args.remote_group or parsed_args.src_group, + parsed_args.remote_group, ignore_missing=False ).id - if parsed_args.src_group: - LOG.warning( - _("The %(old)s option is deprecated, " - "please use %(new)s instead."), - {'old': '--src-group', 'new': '--remote-group'}, - ) - elif not (parsed_args.remote_ip is None and - parsed_args.src_ip is None): - attrs['remote_ip_prefix'] = ( - parsed_args.remote_ip or parsed_args.src_ip - ) - if parsed_args.src_ip: - LOG.warning( - _("The %(old)s option is deprecated, " - "please use %(new)s instead."), - {'old': '--src-ip', 'new': '--remote-ip'}, - ) + elif parsed_args.remote_ip is not None: + attrs['remote_ip_prefix'] = parsed_args.remote_ip elif attrs['ethertype'] == 'IPv4': attrs['remote_ip_prefix'] = '0.0.0.0/0' attrs['security_group_id'] = security_group_id @@ -361,29 +330,13 @@ class CreateSecurityGroupRule(common.NetworkAndComputeShowOne): else: from_port, to_port = parsed_args.dst_port - # NOTE(dtroyer): --src-ip and --src-group were deprecated in Nov 2016. - # Do not remove before 4.x release or Nov 2017. remote_ip = None - if not (parsed_args.remote_group is None and - parsed_args.src_group is None): + if parsed_args.remote_group is not None: parsed_args.remote_group = client.api.security_group_find( - parsed_args.remote_group or parsed_args.src_group, + parsed_args.remote_group, )['id'] - if parsed_args.src_group: - LOG.warning( - _("The %(old)s option is deprecated, " - "please use %(new)s instead."), - {'old': '--src-group', 'new': '--remote-group'}, - ) - if not (parsed_args.remote_ip is None and - parsed_args.src_ip is None): - remote_ip = parsed_args.remote_ip or parsed_args.src_ip - if parsed_args.src_ip: - LOG.warning( - _("The %(old)s option is deprecated, " - "please use %(new)s instead."), - {'old': '--src-ip', 'new': '--remote-ip'}, - ) + if parsed_args.remote_ip is not None: + remote_ip = parsed_args.remote_ip else: remote_ip = '0.0.0.0/0' |
