From daaf1613b3813d4495e668df3177381bcdf8c7e1 Mon Sep 17 00:00:00 2001 From: Zhenggen Xu Date: Tue, 3 Apr 2018 10:17:10 -0700 Subject: [PATCH] Fix/enhance the messages when use do "config load" and "config reload" RB=1270297 G=lnos-reviewers R=ntrianta,pmao,rmolina,sfardeen,zxu A= --- config/main.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/config/main.py b/config/main.py index 14708b946d..5dec73c1d2 100755 --- a/config/main.py +++ b/config/main.py @@ -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]