From b292905894e536dea7e22972ceb6b3344d4f773c Mon Sep 17 00:00:00 2001 From: zhenggen-xu Date: Tue, 26 Jun 2018 08:53:09 -0700 Subject: [PATCH] Fix/enhance the messages when user do "config load" or "config reload" with files (#264) --- config/main.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/config/main.py b/config/main.py index cb7a18b7f008..6b53a1246c26 100755 --- a/config/main.py +++ b/config/main.py @@ -180,22 +180,24 @@ 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.""" #Stop services before config push _stop_services() + 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]