From e2f62ebd923b9afec42562f8d246347fc0aaa2f8 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Fri, 3 Apr 2020 03:59:35 -0700 Subject: [PATCH] Explicitly specify command names with underscores (continued) (#852) --- config/main.py | 16 ++++++++-------- debug/main.py | 6 +++--- pddf_fanutil/main.py | 2 +- pddf_psuutil/main.py | 2 +- pddf_thermalutil/main.py | 2 +- pfcwd/main.py | 4 ++-- show/main.py | 8 ++++---- sonic_installer/main.py | 10 +++++----- undebug/main.py | 6 +++--- 9 files changed, 28 insertions(+), 28 deletions(-) diff --git a/config/main.py b/config/main.py index 664feef82a..62acb28882 100755 --- a/config/main.py +++ b/config/main.py @@ -770,7 +770,7 @@ def del_portchannel_member(ctx, portchannel_name, port_name): # # 'mirror_session' group ('config mirror_session ...') # -@config.group() +@config.group('mirror_session') def mirror_session(): pass @@ -875,7 +875,7 @@ def interval(poll_interval, verbose): run_command(cmd, display_cmd=verbose) -@pfcwd.command() +@pfcwd.command('counter_poll') @click.option('--verbose', is_flag=True, help="Enable verbose output") @click.argument('counter_poll', type=click.Choice(['enable', 'disable'])) def counter_poll(counter_poll, verbose): @@ -885,7 +885,7 @@ def counter_poll(counter_poll, verbose): run_command(cmd, display_cmd=verbose) -@pfcwd.command() +@pfcwd.command('big_red_switch') @click.option('--verbose', is_flag=True, help="Enable verbose output") @click.argument('big_red_switch', type=click.Choice(['enable', 'disable'])) def big_red_switch(big_red_switch, verbose): @@ -895,7 +895,7 @@ def big_red_switch(big_red_switch, verbose): run_command(cmd, display_cmd=verbose) -@pfcwd.command() +@pfcwd.command('start_default') @click.option('--verbose', is_flag=True, help="Enable verbose output") def start_default(verbose): """ Start PFC WD by default configurations """ @@ -945,7 +945,7 @@ def reload(): # # 'warm_restart' group ('config warm_restart ...') # -@config.group() +@config.group('warm_restart') @click.pass_context @click.option('-s', '--redis-unix-socket-path', help='unix socket path for redis connection') def warm_restart(ctx, redis_unix_socket_path): @@ -1392,7 +1392,7 @@ def memory(kdump_memory): config_db.mod_entry("KDUMP", "config", {"memory": kdump_memory}) run_command("sonic-kdump-config --memory %s" % kdump_memory) -@kdump.command() +@kdump.command('num-dumps') @click.argument('kdump_num_dumps', metavar='', required=True, type=int) def num_dumps(kdump_num_dumps): """Set max number of dump files for kdump""" @@ -2109,7 +2109,7 @@ def delete(counter_name, verbose): # # 'add_reasons' subcommand ('config dropcounters add_reasons') # -@dropcounters.command() +@dropcounters.command('add-reasons') @click.argument("counter_name", type=str, required=True) @click.argument("reasons", type=str, required=True) @click.option('-v', '--verbose', is_flag=True, help="Enable verbose output") @@ -2122,7 +2122,7 @@ def add_reasons(counter_name, reasons, verbose): # # 'remove_reasons' subcommand ('config dropcounters remove_reasons') # -@dropcounters.command() +@dropcounters.command('remove-reasons') @click.argument("counter_name", type=str, required=True) @click.argument("reasons", type=str, required=True) @click.option('-v', '--verbose', is_flag=True, help="Enable verbose output") diff --git a/debug/main.py b/debug/main.py index eb099556c2..956c72404c 100755 --- a/debug/main.py +++ b/debug/main.py @@ -38,7 +38,7 @@ def bgp(): """debug bgp group """ pass - @bgp.command() + @bgp.command('allow-martians') def allow_martians(): """BGP allow martian next hops""" command = 'sudo vtysh -c "debug bgp allow-martians"' @@ -71,7 +71,7 @@ def keepalives(prefix_or_iface): command += '"' run_command(command) - @bgp.command() + @bgp.command('neighbor-events') @click.argument('prefix_or_iface', required=False) def neighbor_events(prefix_or_iface): """BGP Neighbor Events""" @@ -97,7 +97,7 @@ def pbr(additional): command += '"' run_command(command) - @bgp.command() + @bgp.command('update-groups') def update_groups(): """BGP update-groups""" command = 'sudo vtysh -c "debug bgp update-groups"' diff --git a/pddf_fanutil/main.py b/pddf_fanutil/main.py index dee001603b..68db948e63 100644 --- a/pddf_fanutil/main.py +++ b/pddf_fanutil/main.py @@ -178,7 +178,7 @@ def debug(): """pddf_fanutil debug commands""" pass -@debug.command() +@debug.command('dump-sysfs') def dump_sysfs(): """Dump all Fan related SysFS paths""" status = platform_fanutil.dump_sysfs() diff --git a/pddf_psuutil/main.py b/pddf_psuutil/main.py index 1a00a3b774..a034f34a08 100644 --- a/pddf_psuutil/main.py +++ b/pddf_psuutil/main.py @@ -180,7 +180,7 @@ def debug(): """pddf_psuutil debug commands""" pass -@debug.command() +@debug.command('dump-sysfs') def dump_sysfs(): """Dump all PSU related SysFS paths""" status = platform_psuutil.dump_sysfs() diff --git a/pddf_thermalutil/main.py b/pddf_thermalutil/main.py index c72e9d45dd..be91273a7b 100644 --- a/pddf_thermalutil/main.py +++ b/pddf_thermalutil/main.py @@ -105,7 +105,7 @@ def debug(): """pddf_thermalutil debug commands""" pass -@debug.command() +@debug.command('dump-sysfs') def dump_sysfs(): """Dump all Temp Sensor related SysFS paths""" status = platform_thermalutil.dump_sysfs() diff --git a/pfcwd/main.py b/pfcwd/main.py index 3a27e993a8..eb4daa15ec 100644 --- a/pfcwd/main.py +++ b/pfcwd/main.py @@ -254,7 +254,7 @@ def start_default(): configdb.mod_entry(CONFIG_DB_PFC_WD_TABLE_NAME, "GLOBAL", pfcwd_info) # Enable/disable PFC WD counter polling -@cli.command() +@cli.command('counter_poll') @click.argument('counter_poll', type=click.Choice(['enable', 'disable'])) def counter_poll(counter_poll): """ Enable/disable counter polling """ @@ -267,7 +267,7 @@ def counter_poll(counter_poll): configdb.mod_entry("FLEX_COUNTER_TABLE", "PFCWD", pfcwd_info) # Enable/disable PFC WD BIG_RED_SWITCH mode -@cli.command() +@cli.command('big_red_switch') @click.argument('big_red_switch', type=click.Choice(['enable', 'disable'])) def big_red_switch(big_red_switch): """ Enable/disable BIG_RED_SWITCH mode """ diff --git a/show/main.py b/show/main.py index f5a5a1340d..566874d4ca 100755 --- a/show/main.py +++ b/show/main.py @@ -687,7 +687,7 @@ def mgmt_vrf(ctx,routes): # 'management_interface' group ("show management_interface ...") # -@cli.group(cls=AliasedGroup, default_if_no_args=False) +@cli.group(name='management_interface', cls=AliasedGroup, default_if_no_args=False) def management_interface(): """Show management interface parameters""" pass @@ -1095,7 +1095,7 @@ def stats(verbose): run_command(cmd, display_cmd=verbose) # 'naming_mode' subcommand ("show interfaces naming_mode") -@interfaces.command() +@interfaces.command('naming_mode') @click.option('--verbose', is_flag=True, help="Enable verbose output") def naming_mode(verbose): """Show interface naming_mode status""" @@ -2354,7 +2354,7 @@ def tacacs(): # # 'mirror_session' command ("show mirror_session ...") # -@cli.command() +@cli.command('mirror_session') @click.argument('session_name', required=False) @click.option('--verbose', is_flag=True, help="Enable verbose output") def mirror_session(session_name, verbose): @@ -2626,7 +2626,7 @@ def line(): return -@cli.group(cls=AliasedGroup, default_if_no_args=False) +@cli.group(name='warm_restart', cls=AliasedGroup, default_if_no_args=False) def warm_restart(): """Show warm restart configuration and state""" pass diff --git a/sonic_installer/main.py b/sonic_installer/main.py index 393055b3f6..32be097dd0 100644 --- a/sonic_installer/main.py +++ b/sonic_installer/main.py @@ -449,7 +449,7 @@ def list(): click.echo(image) # Set default image for boot -@cli.command() +@cli.command('set_default') @click.argument('image') def set_default(image): """ Choose image to boot from by default """ @@ -459,7 +459,7 @@ def set_default(image): # Set image for next boot -@cli.command() +@cli.command('set_next_boot') @click.argument('image') def set_next_boot(image): """ Choose image for next reboot (one time action) """ @@ -499,7 +499,7 @@ def remove(image): remove_image(image) # Retrieve version from binary image file and print to screen -@cli.command() +@cli.command('binary_version') @click.argument('binary_image_path') def binary_version(binary_image_path): """ Get version from local binary image file """ @@ -530,7 +530,7 @@ def cleanup(): click.echo("No image(s) to remove") # Upgrade docker image -@cli.command() +@cli.command('upgrade_docker') @click.option('-y', '--yes', is_flag=True, callback=abort_if_false, expose_value=False, prompt='New docker image will be installed, continue?') @click.option('--cleanup_image', is_flag=True, help="Clean up old docker image") @@ -694,7 +694,7 @@ def upgrade_docker(container_name, url, cleanup_image, skip_check, tag, warm): sys.exit(1) # rollback docker image -@cli.command() +@cli.command('rollback_docker') @click.option('-y', '--yes', is_flag=True, callback=abort_if_false, expose_value=False, prompt='Docker image will be rolled back, continue?') @click.argument('container_name', metavar='', required=True, diff --git a/undebug/main.py b/undebug/main.py index 96bdd3c1f8..55f62ebb3f 100644 --- a/undebug/main.py +++ b/undebug/main.py @@ -38,7 +38,7 @@ def bgp(): """debug bgp group """ pass - @bgp.command() + @bgp.command('allow-martians') def allow_martians(): """BGP allow martian next hops""" command = 'sudo vtysh -c "no debug bgp allow-martians"' @@ -71,7 +71,7 @@ def keepalives(prefix_or_iface): command += '"' run_command(command) - @bgp.command() + @bgp.command('neighbor-events') @click.argument('prefix_or_iface', required=False) def neighbor_events(prefix_or_iface): """BGP Neighbor Events""" @@ -97,7 +97,7 @@ def pbr(additional): command += '"' run_command(command) - @bgp.command() + @bgp.command('update-groups') def update_groups(): """BGP update-groups""" command = 'sudo vtysh -c "no debug bgp update-groups"'