-
Notifications
You must be signed in to change notification settings - Fork 669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validate config_db json file before config reload #3063
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1515,6 +1515,18 @@ def reload(db, filename, yes, load_sysinfo, no_service_restart, force, file_form | |
click.echo("Input {} config file(s) separated by comma for multiple files ".format(num_cfg_file)) | ||
return | ||
|
||
#Validate config_db.json file | ||
if file_format == 'config_db': | ||
file = DEFAULT_CONFIG_DB_FILE | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
if os.path.exists(file): | ||
command = [SONIC_CFGGEN_PATH, '-j', file] | ||
clicommon.run_command(command) | ||
for inst in range(0, num_cfg_file-1): | ||
file = "/etc/sonic/config_db{}.json".format(inst) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @AnoopKamath is this tested on multi-asic platform? |
||
if os.path.exists(file): | ||
command = [SONIC_CFGGEN_PATH, '-j', file] | ||
clicommon.run_command(command) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @AnoopKamath will this raise exception on failure? |
||
|
||
#Stop services before config push | ||
if not no_service_restart: | ||
log.log_notice("'reload' stopping services...") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add one blank after
#
. I notice some old code does not follow, but let's align the new code with the code style.