-
Notifications
You must be signed in to change notification settings - Fork 684
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
[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 |
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.
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.
Updated!
config/kdump.py
Outdated
config_db = ConfigDBConnector() | ||
if config_db is not None: | ||
if config_db: |
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.
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.
Good catch! If this condition is false, we need show an error message to user instead of exiting silently.
config/kdump.py
Outdated
config_db.connect() | ||
kdump_table = config_db.get_table("KDUMP") | ||
if "config" not in kdump_table: |
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.
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.
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.
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.
As comment
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you reuse code? I see it 4 times in this file. #Closed
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.
Updated!
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please indent like others in this file.
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.
I see you mix TAB with SPACE
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.
Good catch! Updated.
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.
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
config
command 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 theKDUMP
table and corresponding field does exist in the table.How to verify it
I verifies this on device
str-msn2700-03
and 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)