Skip to content

Commit

Permalink
Fix/enhance the messages when use do "config load" and "config reload"
Browse files Browse the repository at this point in the history
    RB=1270297
    G=lnos-reviewers
    R=ntrianta,pmao,rmolina,sfardeen,zxu
    A=
  • Loading branch information
zhenggen-xu committed Apr 4, 2018
1 parent a29d1c1 commit daaf161
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,20 +127,22 @@ def save(filename):
run_command(command, display_cmd=True)

@cli.command()
@click.option('-y', '--yes', is_flag=True, callback=_abort_if_false,
expose_value=False, prompt='Reload all config?')
@click.option('-y', '--yes', is_flag=True)
@click.argument('filename', default='/etc/sonic/config_db.json', type=click.Path(exists=True))
def load(filename):
def load(filename, yes):
"""Import a previous saved config DB dump file."""
if not yes:
click.confirm('Load config from the file %s?' % filename, abort=True)
command = "{} -j {} --write-to-db".format(SONIC_CFGGEN_PATH, filename)
run_command(command, display_cmd=True)

@cli.command()
@click.option('-y', '--yes', is_flag=True, callback=_abort_if_false,
expose_value=False, prompt='Clear current and reload all config?')
@click.option('-y', '--yes', is_flag=True)
@click.argument('filename', default='/etc/sonic/config_db.json', type=click.Path(exists=True))
def reload(filename):
def reload(filename, yes):
"""Clear current configuration and import a previous saved config DB dump file."""
if not yes:
click.confirm('Clear current config and reload config from the file %s?' % filename, abort=True)
config_db = ConfigDBConnector()
config_db.connect()
client = config_db.redis_clients[config_db.CONFIG_DB]
Expand Down

0 comments on commit daaf161

Please sign in to comment.