Skip to content

Commit b292905

Browse files
zhenggen-xulguohan
authored andcommitted
Fix/enhance the messages when user do "config load" or "config reload" with files (#264)
1 parent c5049ac commit b292905

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

config/main.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -180,22 +180,24 @@ def save(filename):
180180
run_command(command, display_cmd=True)
181181

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

191192
@cli.command()
192-
@click.option('-y', '--yes', is_flag=True, callback=_abort_if_false,
193-
expose_value=False, prompt='Clear current and reload all config?')
193+
@click.option('-y', '--yes', is_flag=True)
194194
@click.argument('filename', default='/etc/sonic/config_db.json', type=click.Path(exists=True))
195-
def reload(filename):
195+
def reload(filename, yes):
196196
"""Clear current configuration and import a previous saved config DB dump file."""
197197
#Stop services before config push
198198
_stop_services()
199+
if not yes:
200+
click.confirm('Clear current config and reload config from the file %s?' % filename, abort=True)
199201
config_db = ConfigDBConnector()
200202
config_db.connect()
201203
client = config_db.redis_clients[config_db.CONFIG_DB]

0 commit comments

Comments
 (0)