-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Corefile uploader service #3887
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
Merged
renukamanavalan
merged 6 commits into
sonic-net:master
from
renukamanavalan:core_uploader
Dec 16, 2019
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
743377f
Corefile uploader service
renukamanavalan 91e995f
Remove rw permission for .rc file for group & others.
renukamanavalan 4e97407
Changes per review comments.
renukamanavalan 061dcbb
Azure storage upload requires python module futures, hence added it t…
renukamanavalan 00bfd63
Removed trailing spaces.
renukamanavalan 0a2b908
A mistake in name corrected.
renukamanavalan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
21 changes: 10 additions & 11 deletions
21
files/image_config/corefile_uploader/core_analyzer.rc.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,17 @@ | ||
| { | ||
| "env": { | ||
| "https_proxy": "" | ||
| }, | ||
| "azure_sonic_core_storage": { | ||
| "account_name": "corefilecollection", | ||
| "account_key": "", | ||
| "share_name": "corefiles-root" | ||
| }, | ||
| "local_work": { | ||
| "core_upload": "/tmp/core_upload/" | ||
| }, | ||
| }, | ||
| "azure_sonic_core_storage": { | ||
| "account_name": "corefilecollection", | ||
| "account_key": "", | ||
| "share_name": "corefiles-root" | ||
| }, | ||
| "metadata_files_in_archive": { | ||
| "version": "/etc/sonic/sonic_version.yml", | ||
| "version": "/etc/sonic/sonic_version.yml", | ||
| "core_info": "core_info.json" | ||
| }, | ||
| "env": { | ||
| "https_proxy": "" | ||
| } | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| #! /usr/bin/env python | ||
|
|
||
| import os | ||
| import sys | ||
| import json | ||
| import argparse | ||
|
|
||
| TMP_SUFFIX = ".tmp" | ||
| BAK_SUFFIX = ".bak" | ||
|
|
||
| def dict_update(dst, patch): | ||
| for k in patch.keys(): | ||
| if type(patch[k]) == dict: | ||
| dst[k] = dict_update(dst[k], patch[k]) | ||
| else: | ||
| dst[k] = patch[k] | ||
| return dst | ||
|
|
||
| def do_update(rcf, patchf): | ||
| dst = {} | ||
| patch = {} | ||
|
|
||
| tmpf = rcf + TMP_SUFFIX | ||
| bakf = rcf + BAK_SUFFIX | ||
|
|
||
| with open(srcf, "r") as f: | ||
| dst = json.load(f) | ||
|
|
||
| with open(patchf, "r") as f: | ||
| patch = json.load(f) | ||
|
|
||
| dst = dict_update(dst, patch) | ||
|
|
||
| with open(tmpf, "w") as f: | ||
| json.dump(dst, f, indent = 4) | ||
|
|
||
| os.rename(rcf, bakf) | ||
| os.rename(tmpf, rcf) | ||
|
|
||
|
|
||
| def main(): | ||
| parser=argparse.ArgumentParser(description="Update JSON based file") | ||
| parser.add_argument("-r", "--rc", help="JSON file to be updated") | ||
| parser.add_argument("-p", "--patch", help="JSON file holding patch") | ||
| args = parser.parse_args() | ||
|
|
||
| if not args.rc or not args.patch: | ||
| raise Exception("check usage") | ||
|
|
||
| do_update(args.rc, args.patch) | ||
|
|
||
| if __name__ == '__main__': | ||
| main() | ||
|
|
||
|
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.