1313
1414"""Router action implementations"""
1515
16+ import argparse
1617import json
18+ import logging
1719
1820from openstackclient .common import command
1921from openstackclient .common import exceptions
2325from openstackclient .identity import common as identity_common
2426
2527
28+ LOG = logging .getLogger (__name__ )
29+
30+
2631def _format_admin_state (state ):
2732 return 'UP' if state else 'DOWN'
2833
@@ -379,10 +384,15 @@ def get_parser(self, prog_name):
379384 "(repeat option to set multiple routes)" )
380385 )
381386 routes_group .add_argument (
382- '--clear-routes ' ,
387+ '--no-route ' ,
383388 action = 'store_true' ,
384389 help = _ ("Clear routes associated with the router" )
385390 )
391+ routes_group .add_argument (
392+ '--clear-routes' ,
393+ action = 'store_true' ,
394+ help = argparse .SUPPRESS ,
395+ )
386396
387397 # TODO(tangchen): Support setting 'ha' property in 'router set'
388398 # command. It appears that changing the ha state is supported by
@@ -401,8 +411,14 @@ def take_action(self, parsed_args):
401411 attrs = _get_attrs (self .app .client_manager , parsed_args )
402412
403413 # Get the route attributes.
404- if parsed_args .clear_routes :
414+ if parsed_args .no_route :
415+ attrs ['routes' ] = []
416+ elif parsed_args .clear_routes :
405417 attrs ['routes' ] = []
418+ LOG .warning (_ (
419+ 'The --clear-routes option is deprecated, '
420+ 'please use --no-route instead.'
421+ ))
406422 elif parsed_args .routes is not None :
407423 # Map the route keys and append to the current routes.
408424 # The REST API will handle route validation and duplicates.
0 commit comments