Skip to content

Commit

Permalink
Explicitly specify command names with underscores (continued) (sonic-…
Browse files Browse the repository at this point in the history
  • Loading branch information
jleveque authored and abdosi committed Aug 3, 2020
1 parent a531039 commit e2f62eb
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 28 deletions.
16 changes: 8 additions & 8 deletions config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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):
Expand All @@ -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):
Expand All @@ -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 """
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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='<kdump_num_dumps>', required=True, type=int)
def num_dumps(kdump_num_dumps):
"""Set max number of dump files for kdump"""
Expand Down Expand Up @@ -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")
Expand All @@ -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")
Expand Down
6 changes: 3 additions & 3 deletions debug/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"'
Expand Down Expand Up @@ -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"""
Expand All @@ -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"'
Expand Down
2 changes: 1 addition & 1 deletion pddf_fanutil/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion pddf_psuutil/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion pddf_thermalutil/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions pfcwd/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 """
Expand All @@ -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 """
Expand Down
8 changes: 4 additions & 4 deletions show/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"""
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions sonic_installer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 """
Expand All @@ -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) """
Expand Down Expand Up @@ -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 """
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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='<container_name>', required=True,
Expand Down
6 changes: 3 additions & 3 deletions undebug/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"'
Expand Down Expand Up @@ -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"""
Expand All @@ -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"'
Expand Down

0 comments on commit e2f62eb

Please sign in to comment.