[Config] Update config command of kdump#1700
Conversation
Signed-off-by: Yong Zhao <[email protected]>
|
This pull request introduces 1 alert when merging 6a235b8 into 186d851 - view on LGTM.com new alerts:
|
Signed-off-by: Yong Zhao <[email protected]>
Signed-off-by: Yong Zhao <[email protected]>
config/kdump.py
Outdated
| import click | ||
| import utilities_common.cli as clicommon | ||
| from swsscommon.swsscommon import ConfigDBConnector | ||
| from swsssdk import ConfigDBConnector |
config/kdump.py
Outdated
| """Disable kdump feature""" | ||
| config_db = ConfigDBConnector() | ||
| if config_db is not None: | ||
| if config_db: |
There was a problem hiding this comment.
Good catch! If this condition is false, we need show an error message to user instead of exiting silently.
config/kdump.py
Outdated
| if config_db: | ||
| config_db.connect() | ||
| kdump_table = config_db.get_table("KDUMP") | ||
| if "config" not in kdump_table: |
There was a problem hiding this comment.
If the configuration of KDUMP is not present in CONIFG_DB or some keys are missing , then this error will be shown to user.
The user can try to run the command sudo config reload -y to refresh the CONFIG_DB to solve this issue.
1.Use the `libswsscommon` instead of `swsssdk`. 2.Show an error message when an instance of `ConfigDBConnector` can not be created. Signed-off-by: Yong Zhao <[email protected]>
Signed-off-by: Yong Zhao <[email protected]>
config/kdump.py
Outdated
|
|
||
| if "config" not in kdump_table: | ||
| click.echo("Unable to retrieve key 'config' from KDUMP table.") | ||
| sys.exit(6) |
There was a problem hiding this comment.
Could you reuse code? I see it 4 times in this file. #Closed
was configured in Config_DB or not. Signed-off-by: Yong Zhao <[email protected]>
tests/mock_tables/config_db.json
Outdated
| "KDUMP|config": { | ||
| "enabled": "false", | ||
| "memory": "256MB", | ||
| "num_dumps": "3" |
There was a problem hiding this comment.
Please indent like others in this file.
There was a problem hiding this comment.
I see you mix TAB with SPACE
There was a problem hiding this comment.
Good catch! Updated.
qiluo-msft
left a comment
There was a problem hiding this comment.
One minor issue added
Signed-off-by: Yong Zhao <[email protected]>
|
This PR could not be cleanly cherry-pick to 202012. Please submit another PR. |
Please review this PR against 202012: #1778. |
Signed-off-by: Yong Zhao [email protected]
What I did
This PR aims to update the
configcommand of Kdump (Linux kernel dump) mechanism.How I did it
Before updating the value of a field in the table of
KDUMP, we need decide whether theKDUMPtable and corresponding field does exist in the table.How to verify it
I verifies this on device
str-msn2700-03and unit test passed.Previous command output (if the output of a command-line utility has changed)
New command output (if the output of a command-line utility has changed)