@@ -180,22 +180,24 @@ def save(filename):
180
180
run_command (command , display_cmd = True )
181
181
182
182
@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 )
185
184
@click .argument ('filename' , default = '/etc/sonic/config_db.json' , type = click .Path (exists = True ))
186
- def load (filename ):
185
+ def load (filename , yes ):
187
186
"""Import a previous saved config DB dump file."""
187
+ if not yes :
188
+ click .confirm ('Load config from the file %s?' % filename , abort = True )
188
189
command = "{} -j {} --write-to-db" .format (SONIC_CFGGEN_PATH , filename )
189
190
run_command (command , display_cmd = True )
190
191
191
192
@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 )
194
194
@click .argument ('filename' , default = '/etc/sonic/config_db.json' , type = click .Path (exists = True ))
195
- def reload (filename ):
195
+ def reload (filename , yes ):
196
196
"""Clear current configuration and import a previous saved config DB dump file."""
197
197
#Stop services before config push
198
198
_stop_services ()
199
+ if not yes :
200
+ click .confirm ('Clear current config and reload config from the file %s?' % filename , abort = True )
199
201
config_db = ConfigDBConnector ()
200
202
config_db .connect ()
201
203
client = config_db .redis_clients [config_db .CONFIG_DB ]
0 commit comments