Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[201911] Explicitly specify command names with underscores (continued) #868

Merged
merged 1 commit into from
Apr 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,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 @@ -870,7 +870,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 @@ -880,7 +880,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 @@ -890,7 +890,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 @@ -940,7 +940,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 @@ -2038,7 +2038,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 @@ -2051,7 +2051,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
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 @@ -686,7 +686,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 @@ -1068,7 +1068,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 @@ -2240,7 +2240,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 @@ -2512,7 +2512,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 @@ -385,7 +385,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 @@ -395,7 +395,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 @@ -430,7 +430,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 @@ -461,7 +461,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 @@ -628,7 +628,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