-
Notifications
You must be signed in to change notification settings - Fork 669
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
104 changed files
with
16,502 additions
and
1,501 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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,44 @@ | ||
import os | ||
import click | ||
import utilities_common.cli as clicommon | ||
from swsssdk import ConfigDBConnector | ||
|
||
@click.group(cls=clicommon.AbbreviationGroup, name="kdump") | ||
def kdump(): | ||
""" Configure kdump """ | ||
if os.geteuid() != 0: | ||
exit("Root privileges are required for this operation") | ||
|
||
@kdump.command() | ||
def disable(): | ||
"""Disable kdump operation""" | ||
config_db = ConfigDBConnector() | ||
if config_db is not None: | ||
config_db.connect() | ||
config_db.mod_entry("KDUMP", "config", {"enabled": "false"}) | ||
|
||
@kdump.command() | ||
def enable(): | ||
"""Enable kdump operation""" | ||
config_db = ConfigDBConnector() | ||
if config_db is not None: | ||
config_db.connect() | ||
config_db.mod_entry("KDUMP", "config", {"enabled": "true"}) | ||
|
||
@kdump.command() | ||
@click.argument('kdump_memory', metavar='<kdump_memory>', required=True) | ||
def memory(kdump_memory): | ||
"""Set memory allocated for kdump capture kernel""" | ||
config_db = ConfigDBConnector() | ||
if config_db is not None: | ||
config_db.connect() | ||
config_db.mod_entry("KDUMP", "config", {"memory": kdump_memory}) | ||
|
||
@kdump.command('num-dumps') | ||
@click.argument('kdump_num_dumps', metavar='<kdump_num_dumps>', required=True, type=int) | ||
def num_dumps(kdump_num_dumps): | ||
"""Set max number of dump files for kdump""" | ||
config_db = ConfigDBConnector() | ||
if config_db is not None: | ||
config_db.connect() | ||
config_db.mod_entry("KDUMP", "config", {"num_dumps": kdump_num_dumps}) |
This file contains 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
Oops, something went wrong.