black: re-format
black and isort are enabled in the openbmc-build-scripts on Python files
to have a consistent formatting. Re-run the formatter on the whole
repository.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I944f1915ece753f72a3fa654902d445a9749d0f9
diff --git a/bin/auto_status_file.py b/bin/auto_status_file.py
index d1614f3..c3f2544 100755
--- a/bin/auto_status_file.py
+++ b/bin/auto_status_file.py
@@ -4,86 +4,101 @@
See help text for details.
"""
-import sys
-import subprocess
import re
+import subprocess
+import sys
save_dir_path = sys.path.pop(0)
-modules = ['gen_arg', 'gen_print', 'gen_valid', 'gen_misc', 'gen_cmd', 'var_funcs']
+modules = [
+ "gen_arg",
+ "gen_print",
+ "gen_valid",
+ "gen_misc",
+ "gen_cmd",
+ "var_funcs",
+]
for module in modules:
exec("from " + module + " import *")
sys.path.insert(0, save_dir_path)
parser = argparse.ArgumentParser(
- usage='%(prog)s [OPTIONS]',
+ usage="%(prog)s [OPTIONS]",
description="%(prog)s will create a status file path name adhering to the"
- + " following pattern: <status dir path>/<prefix>.yymmdd."
- + "hhmmss.status. It will then run the command string and"
- + " direct its stdout/stderr to the status file and optionally"
- + " to stdout. This dual output streaming will be"
- + " accomplished using either the \"script\" or the \"tee\""
- + " program. %(prog)s will also set and export environment"
- + " variable \"AUTO_STATUS_FILE_PATH\" for the benefit of"
- + " child programs.",
+ + " following pattern: <status dir path>/<prefix>.yymmdd."
+ + "hhmmss.status. It will then run the command string and"
+ + " direct its stdout/stderr to the status file and optionally"
+ + " to stdout. This dual output streaming will be"
+ + ' accomplished using either the "script" or the "tee"'
+ + " program. %(prog)s will also set and export environment"
+ + ' variable "AUTO_STATUS_FILE_PATH" for the benefit of'
+ + " child programs.",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
- prefix_chars='-+')
+ prefix_chars="-+",
+)
parser.add_argument(
- '--status_dir_path',
- default='',
+ "--status_dir_path",
+ default="",
help="The path to the directory where the status file will be created."
- + "%(default)s The default value is obtained from environment"
- + " variable \"${STATUS_DIR_PATH}\", if set or from \"${HOME}/"
- + "status/\".")
+ + "%(default)s The default value is obtained from environment"
+ + ' variable "${STATUS_DIR_PATH}", if set or from "${HOME}/'
+ + 'status/".',
+)
parser.add_argument(
- '--prefix',
- default='',
+ "--prefix",
+ default="",
help="The prefix for the generated file name.%(default)s The default value"
- + " is the command portion (i.e. the first token) of the command"
- + " string.")
+ + " is the command portion (i.e. the first token) of the command"
+ + " string.",
+)
parser.add_argument(
- '--status_file_name',
- default='',
+ "--status_file_name",
+ default="",
help="This allows the user to explicitly specify the status file name. If"
- + " this argument is not used, %(prog)s composes a status file name."
- + " If this argument is specified, the \"--prefix\" argument is"
- + " ignored.")
+ + " this argument is not used, %(prog)s composes a status file name."
+ + ' If this argument is specified, the "--prefix" argument is'
+ + " ignored.",
+)
parser.add_argument(
- '--stdout',
+ "--stdout",
default=1,
type=int,
choices=[1, 0],
help="Indicates that stdout/stderr from the command string execution"
- + " should be written to stdout as well as to the status file.")
+ + " should be written to stdout as well as to the status file.",
+)
parser.add_argument(
- '--tee',
+ "--tee",
default=1,
type=int,
choices=[1, 0],
- help="Indicates that \"tee\" rather than \"script\" should be used.")
+ help='Indicates that "tee" rather than "script" should be used.',
+)
parser.add_argument(
- '--show_url',
+ "--show_url",
default=0,
type=int,
choices=[1, 0],
help="Indicates that the status file path shown should be shown in the"
- + " form of a url. If the output is to be viewed from a browser,"
- + " this may well become a clickable link. Note that the"
- + " get_file_path_url.py program must be found in the \"PATH\""
- + " environment variable for this argument to be effective.")
+ + " form of a url. If the output is to be viewed from a browser,"
+ + " this may well become a clickable link. Note that the"
+ + ' get_file_path_url.py program must be found in the "PATH"'
+ + " environment variable for this argument to be effective.",
+)
parser.add_argument(
- 'command_string',
- default='',
- nargs='*',
- help="The command string to be run.%(default)s")
+ "command_string",
+ default="",
+ nargs="*",
+ help="The command string to be run.%(default)s",
+)
# Populate stock_list with options we want.
stock_list = [("test_mode", 0), ("quiet", 1), ("debug", 0)]
@@ -103,9 +118,9 @@
valid_value(command_string)
if status_dir_path == "":
- status_dir_path = \
- os.environ.get("STATUS_DIR_PATH",
- os.environ.get("HOME") + "/status/")
+ status_dir_path = os.environ.get(
+ "STATUS_DIR_PATH", os.environ.get("HOME") + "/status/"
+ )
status_dir_path = add_trailing_slash(status_dir_path)
set_pgm_arg(status_dir_path)
valid_dir_path(status_dir_path)
@@ -126,9 +141,9 @@
status_file_path = status_dir_path + status_file_name
# Set environment variable for the benefit of child programs.
- os.environ['AUTO_STATUS_FILE_PATH'] = status_file_path
+ os.environ["AUTO_STATUS_FILE_PATH"] = status_file_path
# Set deprecated but still used AUTOSCRIPT_STATUS_FILE_PATH value.
- os.environ['AUTOSCRIPT_STATUS_FILE_PATH'] = status_file_path
+ os.environ["AUTOSCRIPT_STATUS_FILE_PATH"] = status_file_path
def script_func(command_string, status_file_path):
@@ -141,9 +156,15 @@
status_file_path The path to the status file which is to contain a copy of all stdout.
"""
- cmd_buf = "script -a -q -f " + status_file_path + " -c '" \
- + escape_bash_quotes(command_string) + " ; printf \"\\n" \
- + sprint_varx(ret_code_str, "${?}").rstrip("\n") + "\\n\"'"
+ cmd_buf = (
+ "script -a -q -f "
+ + status_file_path
+ + " -c '"
+ + escape_bash_quotes(command_string)
+ + ' ; printf "\\n'
+ + sprint_varx(ret_code_str, "${?}").rstrip("\n")
+ + "\\n\"'"
+ )
qprint_issuing(cmd_buf)
sub_proc = subprocess.Popen(cmd_buf, shell=True)
sub_proc.communicate()
@@ -152,8 +173,13 @@
# Retrieve return code by examining ret_code_str output statement from status file.
# Example text to be analyzed.
# auto_status_file_ret_code: 127
- cmd_buf = "tail -n 10 " + status_file_path + " | egrep -a \"" \
- + ret_code_str + ":[ ]+\""
+ cmd_buf = (
+ "tail -n 10 "
+ + status_file_path
+ + ' | egrep -a "'
+ + ret_code_str
+ + ':[ ]+"'
+ )
rc, output = shell_cmd(cmd_buf)
key, value = parse_key_value(output)
shell_rc = int(value)
@@ -170,8 +196,12 @@
status_file_path The path to the status file which is to contain a copy of all stdout.
"""
- cmd_buf = "set -o pipefail ; " + command_string + " 2>&1 | tee -a " \
+ cmd_buf = (
+ "set -o pipefail ; "
+ + command_string
+ + " 2>&1 | tee -a "
+ status_file_path
+ )
qprint_issuing(cmd_buf)
sub_proc = subprocess.Popen(cmd_buf, shell=True)
sub_proc.communicate()
@@ -187,10 +217,11 @@
def main():
-
gen_setup()
- set_term_options(term_requests={'pgm_names': [command_string.split(" ")[0]]})
+ set_term_options(
+ term_requests={"pgm_names": [command_string.split(" ")[0]]}
+ )
global ret_code_str
ret_code_str = re.sub("\\.py$", "", pgm_name) + "_ret_code"
@@ -202,8 +233,9 @@
show_url = 0
set_pgm_arg(show_url)
else:
- shell_rc, status_file_url = shell_cmd("get_file_path_url.py "
- + status_file_path)
+ shell_rc, status_file_url = shell_cmd(
+ "get_file_path_url.py " + status_file_path
+ )
status_file_url = status_file_url.rstrip("\n")
# Print status file path/url to stdout and to status file.
diff --git a/bin/event_notification_util.py b/bin/event_notification_util.py
index 380a120..9c52176 100755
--- a/bin/event_notification_util.py
+++ b/bin/event_notification_util.py
@@ -8,39 +8,41 @@
save_dir_path = sys.path.pop(0)
-modules = ['gen_arg', 'gen_print', 'gen_valid', 'event_notification']
+modules = ["gen_arg", "gen_print", "gen_valid", "event_notification"]
for module in modules:
exec("from " + module + " import *")
sys.path.insert(0, save_dir_path)
parser = argparse.ArgumentParser(
- usage='%(prog)s [OPTIONS]',
+ usage="%(prog)s [OPTIONS]",
description="%(prog)s will subscribe and receive event notifications when "
- + "properties change for the given dbus path.",
+ + "properties change for the given dbus path.",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
- prefix_chars='-+')
+ prefix_chars="-+",
+)
parser.add_argument(
- '--host',
- default='',
- help='The host name or IP of the system to subscribe to.')
+ "--host",
+ default="",
+ help="The host name or IP of the system to subscribe to.",
+)
parser.add_argument(
- '--username',
- default='root',
- help='The username for the host system.')
+ "--username", default="root", help="The username for the host system."
+)
parser.add_argument(
- '--password',
- default='',
- help='The password for the host system.')
+ "--password", default="", help="The password for the host system."
+)
parser.add_argument(
- '--dbus_path',
- default='',
- help='The path to be monitored (e.g. "/xyz/openbmc_project/sensors").')
+ "--dbus_path",
+ default="",
+ help='The path to be monitored (e.g. "/xyz/openbmc_project/sensors").',
+)
parser.add_argument(
- '--enable_trace',
+ "--enable_trace",
choices=[0, 1],
default=0,
- help='Indicates that trace needs to be enabled.')
+ help="Indicates that trace needs to be enabled.",
+)
# Populate stock_list with options we want.
diff --git a/bin/generate_inventory b/bin/generate_inventory
index 0d90343..c6a7d57 100755
--- a/bin/generate_inventory
+++ b/bin/generate_inventory
@@ -3,56 +3,67 @@
Generate an inventory variable file containing a list of properties
fields from the YAML phosphor-dbus-interfaces repository.
"""
-import sys
-import os
-import yaml
import json
+import os
+import sys
+
+import yaml
lib_path = sys.path[0] + "/../lib"
sys.path.insert(0, lib_path)
-from gen_print import * # NOQA
+from gen_print import * # NOQA
# This list will be longer when more development codes are available.
-inventory_items = ['fru', 'core', 'fan', 'fan_wc', 'gpu']
+inventory_items = ["fru", "core", "fan", "fan_wc", "gpu"]
print_var(inventory_items)
-fru_inventory_file_path = 'inventory.py'
+fru_inventory_file_path = "inventory.py"
print_var(fru_inventory_file_path)
# Properties inventory list
yaml_inventory_list = []
# Clone the phosphor-dbus-interfaces repository
-cmd_buf = 'git clone https://github.com/openbmc/phosphor-dbus-interfaces'
+cmd_buf = "git clone https://github.com/openbmc/phosphor-dbus-interfaces"
os.system(cmd_buf)
-repo_subdir_path = '/phosphor-dbus-interfaces/xyz/openbmc_project/'
+repo_subdir_path = "/phosphor-dbus-interfaces/xyz/openbmc_project/"
base_dir_path = os.getcwd() + repo_subdir_path
# yaml file paths for FRU
-yaml_fru_list = ['Inventory/Item.interface.yaml',
- 'Inventory/Decorator/Asset.interface.yaml',
- 'Inventory/Decorator/Revision.interface.yaml',
- 'Inventory/Decorator/Replaceable.interface.yaml',
- 'Inventory/Decorator/Cacheable.interface.yaml',
- 'State/Decorator/OperationalStatus.interface.yaml', ]
+yaml_fru_list = [
+ "Inventory/Item.interface.yaml",
+ "Inventory/Decorator/Asset.interface.yaml",
+ "Inventory/Decorator/Revision.interface.yaml",
+ "Inventory/Decorator/Replaceable.interface.yaml",
+ "Inventory/Decorator/Cacheable.interface.yaml",
+ "State/Decorator/OperationalStatus.interface.yaml",
+]
# yaml file paths for CORE.
-yaml_core_list = ['Inventory/Item.interface.yaml',
- 'State/Decorator/OperationalStatus.interface.yaml', ]
+yaml_core_list = [
+ "Inventory/Item.interface.yaml",
+ "State/Decorator/OperationalStatus.interface.yaml",
+]
# yaml file paths for fan.
-yaml_fan_list = ['Inventory/Item.interface.yaml',
- 'Inventory/Decorator/MeetsMinimumShipLevel.interface.yaml',
- 'State/Decorator/OperationalStatus.interface.yaml', ]
+yaml_fan_list = [
+ "Inventory/Item.interface.yaml",
+ "Inventory/Decorator/MeetsMinimumShipLevel.interface.yaml",
+ "State/Decorator/OperationalStatus.interface.yaml",
+]
# yaml file paths for fan_wc (fans in water-cooled system).
-yaml_fan_wc_list = ['Inventory/Item.interface.yaml',
- 'Inventory/Decorator/MeetsMinimumShipLevel.interface.yaml', ]
+yaml_fan_wc_list = [
+ "Inventory/Item.interface.yaml",
+ "Inventory/Decorator/MeetsMinimumShipLevel.interface.yaml",
+]
# yaml file paths for GPU.
-yaml_gpu_list = ['Inventory/Item.interface.yaml',
- 'Inventory/Decorator/Replaceable.interface.yaml',
- 'State/Decorator/OperationalStatus.interface.yaml', ]
+yaml_gpu_list = [
+ "Inventory/Item.interface.yaml",
+ "Inventory/Decorator/Replaceable.interface.yaml",
+ "State/Decorator/OperationalStatus.interface.yaml",
+]
# Append to inventory list
yaml_inventory_list.append(yaml_fru_list)
@@ -77,16 +88,18 @@
f = open(yaml_file_path)
yaml_data = yaml.safe_load(f)
f.close()
- for item in range(0, len(yaml_data['properties'])):
- tmp_data = yaml_data['properties'][item]['name']
+ for item in range(0, len(yaml_data["properties"])):
+ tmp_data = yaml_data["properties"][item]["name"]
inventory_dict[str(inventory_items[inv_index])].append(tmp_data)
# Pretty print json formatter
-data = json.dumps(inventory_dict,
- indent=4,
- sort_keys=True,
- default=str,
- separators=(',', ':'))
+data = json.dumps(
+ inventory_dict,
+ indent=4,
+ sort_keys=True,
+ default=str,
+ separators=(",", ":"),
+)
# Check if there is mismatch in data vs expect list
if len(inventory_dict) != len(inventory_items):
@@ -98,8 +111,8 @@
# Write dictionary data to inventory file
print("\nGenerated Inventory item json format\n")
print(data)
-out = open(fru_inventory_file_path, 'w')
-out.write('inventory_dict = ')
+out = open(fru_inventory_file_path, "w")
+out.write("inventory_dict = ")
out.write(data)
out.close()
diff --git a/bin/generate_testsuite_info.py b/bin/generate_testsuite_info.py
index 4a2f115..1847308 100755
--- a/bin/generate_testsuite_info.py
+++ b/bin/generate_testsuite_info.py
@@ -5,53 +5,56 @@
Refer to https://robot-framework.readthedocs.io/en/3.0.1/autodoc/robot.parsing.html
"""
-import sys
import os
+import sys
+
from robot.parsing.model import TestData
+
sys.path.append(os.path.join(os.path.dirname(__file__), "../lib"))
-from gen_arg import * # NOQA
-from gen_print import * # NOQA
-from gen_valid import * # NOQA
+from gen_arg import * # NOQA
+from gen_print import * # NOQA
+from gen_valid import * # NOQA
# Set exit_on_error for gen_valid functions.
set_exit_on_error(True)
-valid_options = ['name', 'tags', 'doc', 'all']
+valid_options = ["name", "tags", "doc", "all"]
parser = argparse.ArgumentParser(
- usage='%(prog)s [OPTIONS]',
- description=";%(prog)s will print test suite information to stdout. This \
- information consists of any and/or all of the following: \
- the suite name, test case names, tag names and doc strings. \
- Example for generated test case names \
- tests/test_basic_poweron.robot \
- Verify Front And Rear LED At Standby \
- Power On Test \
- Check For Application Failures \
- Verify Uptime Average Against Threshold \
- Test SSH And IPMI Connections",
+ usage="%(prog)s [OPTIONS]",
+ description=(
+ ";%(prog)s will print test suite information to stdout. This "
+ " information consists of any and/or all of the following: "
+ " the suite name, test case names, tag names and doc"
+ " strings. Example for generated test case names "
+ " tests/test_basic_poweron.robot "
+ " Verify Front And Rear LED At Standby Power On Test"
+ " Check For Application Failures "
+ " Verify Uptime Average Against Threshold Test SSH"
+ " And IPMI Connections"
+ ),
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
- prefix_chars='-+')
+ prefix_chars="-+",
+)
parser.add_argument(
- '--source_path',
- '-s',
- help='The robot test file or directory path.')
+ "--source_path", "-s", help="The robot test file or directory path."
+)
parser.add_argument(
- '--option',
- '-o',
+ "--option",
+ "-o",
default="name",
- help='Test case attribute name. This may be any one of the following:\n'
- + sprint_var(valid_options))
+ help="Test case attribute name. This may be any one of the following:\n"
+ + sprint_var(valid_options),
+)
# Populate stock_list with options we want.
stock_list = [("test_mode", 0), ("quiet", 0), ("debug", 0)]
-def exit_function(signal_number=0,
- frame=None):
+def exit_function(signal_number=0, frame=None):
r"""
Execute whenever the program ends normally or with the signals that we
catch (i.e. TERM, INT).
@@ -64,8 +67,7 @@
qprint_pgm_footer()
-def signal_handler(signal_number,
- frame):
+def signal_handler(signal_number, frame):
r"""
Handle signals. Without a function to catch a SIGTERM or SIGINT, the
program would terminate immediately with return code 143 and without
@@ -107,9 +109,11 @@
if os.path.isfile(source_path):
file_paths = [source_path]
else:
- file_paths = [os.path.join(path, file)
- for (path, dirs, files) in os.walk(source_path)
- for file in files]
+ file_paths = [
+ os.path.join(path, file)
+ for (path, dirs, files) in os.walk(source_path)
+ for file in files
+ ]
for file_path in file_paths:
print(file_path)
@@ -148,7 +152,6 @@
def main():
-
gen_get_options(parser, stock_list)
validate_parms()
diff --git a/bin/obmc_ser_num b/bin/obmc_ser_num
index 4057316..e56458c 100755
--- a/bin/obmc_ser_num
+++ b/bin/obmc_ser_num
@@ -4,16 +4,17 @@
This program will get the system serial number from an OBMC machine and print it to stdout.
"""
-import sys
import os
+import sys
+
import requests
save_path_0 = sys.path[0]
del sys.path[0]
-from gen_arg import * # NOQA
-from gen_print import * # NOQA
-from gen_valid import * # NOQA
+from gen_arg import * # NOQA
+from gen_print import * # NOQA
+from gen_valid import * # NOQA
# Restore sys.path[0].
sys.path.insert(0, save_path_0)
@@ -21,33 +22,35 @@
logging.captureWarnings(True)
parser = argparse.ArgumentParser(
- usage='%(prog)s [OPTIONS]',
+ usage="%(prog)s [OPTIONS]",
description="%(prog)s will get the system serial number from an OBMC"
+ " machine and print it to stdout as follows:\n\n"
+ "mch_ser_num:<ser num>",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
- prefix_chars='-+')
+ prefix_chars="-+",
+)
parser.add_argument(
- '--openbmc_username',
+ "--openbmc_username",
default="root",
- help='The username for communicating with the OpenBMC machine.')
+ help="The username for communicating with the OpenBMC machine.",
+)
parser.add_argument(
- '--openbmc_password',
+ "--openbmc_password",
default="0penBmc",
- help='The password for communicating with the OpenBMC machine.')
+ help="The password for communicating with the OpenBMC machine.",
+)
parser.add_argument(
- 'openbmc_host',
- help='The host name or IP address of the OpenBMC machine.')
+ "openbmc_host", help="The host name or IP address of the OpenBMC machine."
+)
# Populate stock_list with options we want.
stock_list = [("test_mode", 0), ("quiet", 1)]
-def exit_function(signal_number=0,
- frame=None):
+def exit_function(signal_number=0, frame=None):
r"""
Execute whenever the program ends normally or with the signals that we catch (i.e. TERM, INT).
"""
@@ -58,8 +61,7 @@
qprint_pgm_footer()
-def signal_handler(signal_number,
- frame):
+def signal_handler(signal_number, frame):
r"""
Handle signals. Without a function to catch a SIGTERM or SIGINT, our program would terminate immediately
with return code 143 and without calling our exit_function.
@@ -96,7 +98,6 @@
def main():
-
if not gen_get_options(parser, stock_list):
return False
@@ -109,12 +110,14 @@
http_prefix = create_http_prefix(openbmc_host)
- command = http_prefix + 'login'
+ command = http_prefix + "login"
qprint_issuing(command)
- resp = session.post(command,
- json={'data': [openbmc_username, openbmc_password]},
- verify=False)
- if resp.json()['status'] != 'ok':
+ resp = session.post(
+ command,
+ json={"data": [openbmc_username, openbmc_password]},
+ verify=False,
+ )
+ if resp.json()["status"] != "ok":
json = resp.json()
print_error_report("http request failed:\n" + sprint_var(command))
raise Exception("Login failed.\n")
@@ -123,15 +126,18 @@
qprint_issuing(command)
resp = session.get(command, verify=False)
json = resp.json()
- if json['status'] != 'ok':
+ if json["status"] != "ok":
print_error_report("http request failed:\n" + sprint_var(command))
raise Exception("http request failed.\n")
try:
- mch_ser_num = json['data']['SerialNumber']
+ mch_ser_num = json["data"]["SerialNumber"]
except KeyError:
- print_error_report("Failed to find 'SerialNumber' key in the"
- + " following data:\n" + sprint_var(json))
+ print_error_report(
+ "Failed to find 'SerialNumber' key in the"
+ + " following data:\n"
+ + sprint_var(json)
+ )
return False
print_var(mch_ser_num, 0, 0, 0)
diff --git a/bin/plug_ins/Auto_reboot/cp_master b/bin/plug_ins/Auto_reboot/cp_master
index 7e1b274..8f12588 100755
--- a/bin/plug_ins/Auto_reboot/cp_master
+++ b/bin/plug_ins/Auto_reboot/cp_master
@@ -10,7 +10,15 @@
save_dir_path = sys.path.pop(0)
-modules = ['gen_arg', 'gen_print', 'gen_valid', 'gen_misc', 'gen_cmd', 'gen_plug_in_utils', 'gen_call_robot']
+modules = [
+ "gen_arg",
+ "gen_print",
+ "gen_valid",
+ "gen_misc",
+ "gen_cmd",
+ "gen_plug_in_utils",
+ "gen_call_robot",
+]
for module in modules:
exec("from " + module + " import *")
@@ -21,22 +29,27 @@
set_exit_on_error(True)
parser = argparse.ArgumentParser(
- usage='%(prog)s [OPTIONS]',
- description="%(prog)s will set the auto_boot policy according to the user's wishes.",
+ usage="%(prog)s [OPTIONS]",
+ description=(
+ "%(prog)s will set the auto_boot policy according to the user's"
+ " wishes."
+ ),
formatter_class=argparse.RawTextHelpFormatter,
- prefix_chars='-+')
+ prefix_chars="-+",
+)
# Populate stock_list with options we want.
-stock_list = [("test_mode", get_plug_default("test_mode", 0)),
- ("quiet", get_plug_default("quiet", 0)),
- ("debug", get_plug_default("debug", 0))]
+stock_list = [
+ ("test_mode", get_plug_default("test_mode", 0)),
+ ("quiet", get_plug_default("quiet", 0)),
+ ("debug", get_plug_default("debug", 0)),
+]
AUTO_REBOOT_DISABLE = "1"
def validate_parms():
-
r"""
Validate program parameters, etc. Return True or False (i.e. pass/fail) accordingly.
"""
@@ -53,10 +66,9 @@
def main():
-
gen_setup()
- set_term_options(term_requests='children')
+ set_term_options(term_requests="children")
print_plug_in_header()
@@ -67,18 +79,36 @@
lib_file_path = init_robot_file_path("lib/utils.robot")
- REDFISH_SUPPORT_TRANS_STATE = int(os.environ.get('REDFISH_SUPPORT_TRANS_STATE', 0)) or \
- int(os.environ.get('AUTOBOOT_REDFISH_SUPPORT_TRANS_STATE', 0))
+ REDFISH_SUPPORT_TRANS_STATE = int(
+ os.environ.get("REDFISH_SUPPORT_TRANS_STATE", 0)
+ ) or int(os.environ.get("AUTOBOOT_REDFISH_SUPPORT_TRANS_STATE", 0))
enable_auto_reboot = 1 - AUTO_REBOOT_DISABLE
print_var(enable_auto_reboot)
keyword_string = "Set Auto Reboot Setting ${%i}" % enable_auto_reboot
- cmd_buf = create_robot_cmd_string("extended/run_keyword.robot", OPENBMC_HOST, SSH_PORT, HTTPS_PORT,
- REST_USERNAME, REST_PASSWORD, OPENBMC_USERNAME, OPENBMC_PASSWORD,
- IPMI_USERNAME, IPMI_PASSWORD, REDFISH_SUPPORT_TRANS_STATE,
- keyword_string, lib_file_path, quiet, test_mode, debug, outputdir,
- output, log, report)
+ cmd_buf = create_robot_cmd_string(
+ "extended/run_keyword.robot",
+ OPENBMC_HOST,
+ SSH_PORT,
+ HTTPS_PORT,
+ REST_USERNAME,
+ REST_PASSWORD,
+ OPENBMC_USERNAME,
+ OPENBMC_PASSWORD,
+ IPMI_USERNAME,
+ IPMI_PASSWORD,
+ REDFISH_SUPPORT_TRANS_STATE,
+ keyword_string,
+ lib_file_path,
+ quiet,
+ test_mode,
+ debug,
+ outputdir,
+ output,
+ log,
+ report,
+ )
retry_count = 3
while not robot_cmd_fnc(cmd_buf):
diff --git a/bin/plug_ins/FFDC/cp_ffdc_check b/bin/plug_ins/FFDC/cp_ffdc_check
index 8d51271..b928658 100755
--- a/bin/plug_ins/FFDC/cp_ffdc_check
+++ b/bin/plug_ins/FFDC/cp_ffdc_check
@@ -1,35 +1,41 @@
#!/usr/bin/env python3
+from gen_arg import *
+from gen_call_robot import *
+from gen_cmd import *
+from gen_misc import *
+from gen_plug_in_utils import *
from gen_print import *
from gen_valid import *
-from gen_arg import *
-from gen_misc import *
-from gen_cmd import *
-from gen_plug_in_utils import *
-from gen_call_robot import *
# Set exit_on_error for gen_valid functions.
set_exit_on_error(True)
parser = argparse.ArgumentParser(
- usage='%(prog)s [OPTIONS]',
- description="%(prog)s will determine whether FFDC should be collected. If so, it will return "
- + repr(dump_ffdc_rc()) + ".",
+ usage="%(prog)s [OPTIONS]",
+ description=(
+ "%(prog)s will determine whether FFDC should be collected. If so, it"
+ " will return "
+ )
+ + repr(dump_ffdc_rc())
+ + ".",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
- prefix_chars='-+')
+ prefix_chars="-+",
+)
# The stock_list will be passed to gen_get_options. We populate it with the names of stock parm options we
# want. These stock parms are pre-defined by gen_get_options.
-stock_list = [("test_mode", get_plug_default("test_mode", 0)),
- ("quiet", get_plug_default("quiet", 0)),
- ("debug", get_plug_default("debug", 0))]
+stock_list = [
+ ("test_mode", get_plug_default("test_mode", 0)),
+ ("quiet", get_plug_default("quiet", 0)),
+ ("debug", get_plug_default("debug", 0)),
+]
# For now we are hard-coding this value vs adding a soft_errors=boolean entry in the parm_def file.
FFDC_SOFT_ERRORS = 1
-def exit_function(signal_number=0,
- frame=None):
+def exit_function(signal_number=0, frame=None):
r"""
Execute whenever the program ends normally or with the signals that we catch (i.e. TERM, INT).
@@ -52,14 +58,15 @@
def main():
-
gen_setup()
print_plug_in_header()
if FFDC_COMMAND.upper() == "FAIL":
if AUTOBOOT_BOOT_SUCCESS == "0":
- print_timen("The caller wishes to dump FFDC after each boot failure.")
+ print_timen(
+ "The caller wishes to dump FFDC after each boot failure."
+ )
exit(dump_ffdc_rc())
elif FFDC_COMMAND.upper() == "ALL":
print_timen("The caller wishes to dump FFDC after each boot test.")
@@ -73,8 +80,10 @@
# Check the num_error_logs value left by the Soft_errors plug-in.
num_error_logs = int(restore_plug_in_value(0, "Soft_errors"))
if num_error_logs > 0:
- print_timen("The \"Soft_errors\" plug-in found soft_errors and the"
- + " caller wishes to dump FFDC on soft errors.")
+ print_timen(
+ 'The "Soft_errors" plug-in found soft_errors and the'
+ + " caller wishes to dump FFDC on soft errors."
+ )
exit(dump_ffdc_rc())
print_timen("The caller does not wish for any FFDC to be collected.")
diff --git a/bin/plug_ins/Soft_errors/cp_post_boot b/bin/plug_ins/Soft_errors/cp_post_boot
index 9f9d515..649fd31 100755
--- a/bin/plug_ins/Soft_errors/cp_post_boot
+++ b/bin/plug_ins/Soft_errors/cp_post_boot
@@ -1,13 +1,13 @@
#!/usr/bin/env python3
+from gen_arg import *
+from gen_call_robot import *
+from gen_cmd import *
+from gen_misc import *
+from gen_plug_in_utils import *
from gen_print import *
from gen_valid import *
-from gen_arg import *
-from gen_misc import *
-from gen_cmd import *
from var_funcs import *
-from gen_plug_in_utils import *
-from gen_call_robot import *
# Set exit_on_error for gen_valid functions.
set_exit_on_error(True)
@@ -15,23 +15,25 @@
parser = argparse.ArgumentParser(
- usage='%(prog)s [OPTIONS]',
+ usage="%(prog)s [OPTIONS]",
description="%(prog)s will calculate the value of num_err_logs and"
+ " save it as a plug-in value for the benefit of the FFDC plug-in."
+ " The FFDC plug-in can use that data to decide whether to collect"
+ " FFDC data.",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
- prefix_chars='-+')
+ prefix_chars="-+",
+)
# The stock_list will be passed to gen_get_options. We populate it with the names of stock parm options we
# want. These stock parms are pre-defined by gen_get_options.
-stock_list = [("test_mode", 0),
- ("quiet", get_plug_default("quiet", 0)),
- ("debug", get_plug_default("debug", 0))]
+stock_list = [
+ ("test_mode", 0),
+ ("quiet", get_plug_default("quiet", 0)),
+ ("debug", get_plug_default("debug", 0)),
+]
-def exit_function(signal_number=0,
- frame=None):
+def exit_function(signal_number=0, frame=None):
r"""
Execute whenever the program ends normally or with the signals that we catch (i.e. TERM, INT).
@@ -53,73 +55,116 @@
global AUTOSCRIPT_STATUS_FILE_PATH
# AUTOSCRIPT_STATUS_FILE_PATH is set when we're called by autoscript. For this program to work
# correctly, it must be called with autoscript.
- AUTOSCRIPT_STATUS_FILE_PATH = os.environ.get("AUTOSCRIPT_STATUS_FILE_PATH", "")
+ AUTOSCRIPT_STATUS_FILE_PATH = os.environ.get(
+ "AUTOSCRIPT_STATUS_FILE_PATH", ""
+ )
valid_value(AUTOSCRIPT_STATUS_FILE_PATH)
valid_value(AUTOBOOT_OPENBMC_HOST)
def main():
-
gen_setup()
print_plug_in_header()
# Get the number of error logs from the BMC.
init_robot_out_parms(get_plug_in_package_name() + "." + pgm_name + ".")
- high_sev_elogs_file_path = AUTOBOOT_FFDC_DIR_PATH + AUTOBOOT_FFDC_PREFIX + "high_severity_errorlog.json"
+ high_sev_elogs_file_path = (
+ AUTOBOOT_FFDC_DIR_PATH
+ + AUTOBOOT_FFDC_PREFIX
+ + "high_severity_errorlog.json"
+ )
lib_file_path = init_robot_file_path("lib/logging_utils.robot")
lib_file_path += ":" + init_robot_file_path("lib/gen_robot_print.py")
set_mod_global(lib_file_path)
- REDFISH_SUPPORT_TRANS_STATE = int(os.environ.get('REDFISH_SUPPORT_TRANS_STATE', 0))
+ REDFISH_SUPPORT_TRANS_STATE = int(
+ os.environ.get("REDFISH_SUPPORT_TRANS_STATE", 0)
+ )
if not REDFISH_SUPPORT_TRANS_STATE:
try:
from robot.libraries.BuiltIn import BuiltIn
- REDFISH_SUPPORT_TRANS_STATE = \
- int(BuiltIn().get_variable_value("${REDFISH_SUPPORT_TRANS_STATE}", default=0))
+
+ REDFISH_SUPPORT_TRANS_STATE = int(
+ BuiltIn().get_variable_value(
+ "${REDFISH_SUPPORT_TRANS_STATE}", default=0
+ )
+ )
except Exception:
pass
- keyword_redfish_strings = \
- [
- "${error_logs}= Get Redfish Event Logs &{filter_low_severity_errlogs}",
- "${num_error_logs}= Get Length ${error_logs}",
- "Rprint Vars num_error_logs",
- "${json_string}= Evaluate json.dumps($error_logs, indent=4) modules=json",
- "Append To File " + high_sev_elogs_file_path + " ${json_string}"
- ]
+ keyword_redfish_strings = [
+ (
+ "${error_logs}= Get Redfish Event Logs "
+ " &{filter_low_severity_errlogs}"
+ ),
+ "${num_error_logs}= Get Length ${error_logs}",
+ "Rprint Vars num_error_logs",
+ (
+ "${json_string}= Evaluate json.dumps($error_logs, indent=4) "
+ " modules=json"
+ ),
+ "Append To File " + high_sev_elogs_file_path + " ${json_string}",
+ ]
- keyword_strings = \
- [
- "${error_logs}= Get Error Logs &{filter_low_severity_errlogs}",
- "${num_error_logs}= Get Length ${error_logs}",
- "Rprint Vars num_error_logs",
- "${json_string}= Evaluate json.dumps($error_logs, indent=4) modules=json",
- "Append To File " + high_sev_elogs_file_path + " ${json_string}"
- ]
+ keyword_strings = [
+ "${error_logs}= Get Error Logs &{filter_low_severity_errlogs}",
+ "${num_error_logs}= Get Length ${error_logs}",
+ "Rprint Vars num_error_logs",
+ (
+ "${json_string}= Evaluate json.dumps($error_logs, indent=4) "
+ " modules=json"
+ ),
+ "Append To File " + high_sev_elogs_file_path + " ${json_string}",
+ ]
if REDFISH_SUPPORT_TRANS_STATE:
- keyword_string = ' ; '.join(keyword_redfish_strings)
+ keyword_string = " ; ".join(keyword_redfish_strings)
else:
- keyword_string = ' ; '.join(keyword_strings)
+ keyword_string = " ; ".join(keyword_strings)
set_mod_global(keyword_string)
- cmd_buf = create_robot_cmd_string("extended/run_keyword.robot", OPENBMC_HOST, SSH_PORT, HTTPS_PORT,
- REST_USERNAME, REST_PASSWORD, OPENBMC_USERNAME, OPENBMC_PASSWORD,
- keyword_string, lib_file_path, quiet,
- test_mode, debug, outputdir, output, log, report)
+ cmd_buf = create_robot_cmd_string(
+ "extended/run_keyword.robot",
+ OPENBMC_HOST,
+ SSH_PORT,
+ HTTPS_PORT,
+ REST_USERNAME,
+ REST_PASSWORD,
+ OPENBMC_USERNAME,
+ OPENBMC_PASSWORD,
+ keyword_string,
+ lib_file_path,
+ quiet,
+ test_mode,
+ debug,
+ outputdir,
+ output,
+ log,
+ report,
+ )
if not robot_cmd_fnc(cmd_buf):
exit(1)
# The output contains the num_error_logs value which we will isolate with egrep.
- rc, out_buf = shell_cmd("egrep '^num_error_logs:[ ]' " + AUTOSCRIPT_STATUS_FILE_PATH, quiet=1,
- print_output=0)
+ rc, out_buf = shell_cmd(
+ "egrep '^num_error_logs:[ ]' " + AUTOSCRIPT_STATUS_FILE_PATH,
+ quiet=1,
+ print_output=0,
+ )
result = key_value_outbuf_to_dict(out_buf)
- num_error_logs = int(result['num_error_logs'])
+ num_error_logs = int(result["num_error_logs"])
save_plug_in_value(num_error_logs)
if num_error_logs > 0:
- qprint_timen("Adding the name of our high severity error logs FFDC file "
- + "to the appropriate file list.")
- shell_cmd("echo " + high_sev_elogs_file_path + " > " + AUTOBOOT_FFDC_LIST_FILE_PATH)
+ qprint_timen(
+ "Adding the name of our high severity error logs FFDC file "
+ + "to the appropriate file list."
+ )
+ shell_cmd(
+ "echo "
+ + high_sev_elogs_file_path
+ + " > "
+ + AUTOBOOT_FFDC_LIST_FILE_PATH
+ )
else:
os.remove(high_sev_elogs_file_path)
diff --git a/bin/plug_ins/Stop/cp_stop_check b/bin/plug_ins/Stop/cp_stop_check
index 8eb8e05..994e2d9 100755
--- a/bin/plug_ins/Stop/cp_stop_check
+++ b/bin/plug_ins/Stop/cp_stop_check
@@ -5,56 +5,61 @@
"""
import argparse
-import sys
-import subprocess
import os
import re
+import subprocess
+import sys
+from gen_arg import *
+from gen_call_robot import *
+from gen_cmd import *
+from gen_misc import *
+from gen_plug_in_utils import *
from gen_print import *
from gen_valid import *
-from gen_arg import *
-from gen_misc import *
-from gen_cmd import *
-from gen_plug_in_utils import *
-from gen_call_robot import *
# Set exit_on_error for gen_valid functions.
set_exit_on_error(True)
# Initialize default plug-in parms..
STOP_REST_FAIL = 0
-STOP_COMMAND = ''
+STOP_COMMAND = ""
stop_test_rc = 2
STOP_VERIFY_HARDWARE_FAIL = 0
# Create parser object to process command line parameters and args.
parser = argparse.ArgumentParser(
- usage='%(prog)s [OPTIONS]',
- description="If the \"Stop\" plug-in is selected by the user, %(prog)s"
+ usage="%(prog)s [OPTIONS]",
+ description='If the "Stop" plug-in is selected by the user, %(prog)s'
+ " is called by OBMC Boot Test after each boot test. If %(prog)s returns"
- + " " + str(stop_test_rc) + ", then OBMC Boot Test will stop. The user"
+ + " "
+ + str(stop_test_rc)
+ + ", then OBMC Boot Test will stop. The user"
+ " may set environment variable STOP_COMMAND to contain any valid bash"
+ " command or program. %(prog)s will run this stop command. If the stop"
+ " command returns non-zero, then %(prog)s will return "
- + str(stop_test_rc) + ". %(prog)s recognizes some special values for"
- + " STOP_COMMAND: 1) \"FAIL\" means that OBMC Boot Test should stop"
- + " whenever a boot test fails. 2) \"ALL\" means that OBMC Boot Test"
+ + str(stop_test_rc)
+ + ". %(prog)s recognizes some special values for"
+ + ' STOP_COMMAND: 1) "FAIL" means that OBMC Boot Test should stop'
+ + ' whenever a boot test fails. 2) "ALL" means that OBMC Boot Test'
+ " should stop after any boot test. If environment variable"
+ " STOP_REST_FAIL is set, OBMC Boot Test will stop if REST commands are"
+ " no longer working.",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
- prefix_chars='-+')
+ prefix_chars="-+",
+)
# The stock_list will be passed to gen_get_options. We populate it with the names of stock parm options we
# want. These stock parms are pre-defined by gen_get_options.
-stock_list = [("test_mode", get_plug_default("test_mode", 0)),
- ("quiet", get_plug_default("quiet", 0)),
- ("debug", get_plug_default("debug", 0))]
+stock_list = [
+ ("test_mode", get_plug_default("test_mode", 0)),
+ ("quiet", get_plug_default("quiet", 0)),
+ ("debug", get_plug_default("debug", 0)),
+]
-def exit_function(signal_number=0,
- frame=None):
+def exit_function(signal_number=0, frame=None):
r"""
Execute whenever the program ends normally or with the signals that we catch (i.e. TERM, INT).
@@ -93,8 +98,9 @@
if not STOP_REST_FAIL:
return
- REDFISH_SUPPORT_TRANS_STATE = int(os.environ.get('REDFISH_SUPPORT_TRANS_STATE', 0)) or \
- int(os.environ.get('AUTOBOOT_REDFISH_SUPPORT_TRANS_STATE', 0))
+ REDFISH_SUPPORT_TRANS_STATE = int(
+ os.environ.get("REDFISH_SUPPORT_TRANS_STATE", 0)
+ ) or int(os.environ.get("AUTOBOOT_REDFISH_SUPPORT_TRANS_STATE", 0))
if REDFISH_SUPPORT_TRANS_STATE:
interface = "redfish"
@@ -103,23 +109,54 @@
print_timen("Checking to see whether %s commands are working." % interface)
init_robot_out_parms(get_plug_in_package_name() + "." + pgm_name + ".")
- lib_file_path = init_robot_file_path("lib/utils.robot") + ":" \
+ lib_file_path = (
+ init_robot_file_path("lib/utils.robot")
+ + ":"
+ init_robot_file_path("lib/gen_robot_print.py")
+ )
set_mod_global(lib_file_path)
- timeout = '0 seconds'
- interval = '1 second'
- keyword_string = "${match_state}= Create Dictionary %s=1 ;" % interface +\
- " ${state}= Wait State ${match_state} " + timeout + " " +\
- interval + " quiet=${1} ; Rpvar state"
+ timeout = "0 seconds"
+ interval = "1 second"
+ keyword_string = (
+ "${match_state}= Create Dictionary %s=1 ;" % interface
+ + " ${state}= Wait State ${match_state} "
+ + timeout
+ + " "
+ + interval
+ + " quiet=${1} ; Rpvar state"
+ )
set_mod_global(keyword_string)
- cmd_buf = create_robot_cmd_string("extended/run_keyword.robot", OPENBMC_HOST, SSH_PORT, HTTPS_PORT,
- REST_USERNAME, REST_PASSWORD, OPENBMC_USERNAME, OPENBMC_PASSWORD,
- REDFISH_SUPPORT_TRANS_STATE, keyword_string, lib_file_path, quiet,
- test_mode, debug, outputdir, output, log, report, loglevel)
+ cmd_buf = create_robot_cmd_string(
+ "extended/run_keyword.robot",
+ OPENBMC_HOST,
+ SSH_PORT,
+ HTTPS_PORT,
+ REST_USERNAME,
+ REST_PASSWORD,
+ OPENBMC_USERNAME,
+ OPENBMC_PASSWORD,
+ REDFISH_SUPPORT_TRANS_STATE,
+ keyword_string,
+ lib_file_path,
+ quiet,
+ test_mode,
+ debug,
+ outputdir,
+ output,
+ log,
+ report,
+ loglevel,
+ )
if not robot_cmd_fnc(cmd_buf):
- print_timen("The caller wishes to stop test execution if %s commands are failing." % interface)
+ print_timen(
+ "The caller wishes to stop test execution if %s commands are"
+ " failing." % interface
+ )
stop_check()
- print_timen("%s commands are working so no reason as of yet to stop the test." % interface)
+ print_timen(
+ "%s commands are working so no reason as of yet to stop the test."
+ % interface
+ )
def esel_stop_check():
@@ -131,10 +168,15 @@
if STOP_ESEL_STOP_FILE_PATH == "":
return
- cmd_buf = "esel_stop_check --esel_stop_file_path=" + STOP_ESEL_STOP_FILE_PATH
+ cmd_buf = (
+ "esel_stop_check --esel_stop_file_path=" + STOP_ESEL_STOP_FILE_PATH
+ )
shell_rc, out_buf = shell_cmd(cmd_buf, show_err=0)
if shell_rc == stop_test_rc:
- print_timen("The caller wishes to stop test execution based on the presence of certain esel entries.")
+ print_timen(
+ "The caller wishes to stop test execution based on the presence of"
+ " certain esel entries."
+ )
stop_check()
@@ -147,12 +189,17 @@
if STOP_PEL_STOP_FILE_PATH == "":
return
- pel_txt_file_path = os.environ.get("AUTOBOOT_FFDC_DIR_PATH", "") + \
- os.environ.get("AUTOBOOT_FFDC_PREFIX", "") + "PEL_logs_list.json"
+ pel_txt_file_path = (
+ os.environ.get("AUTOBOOT_FFDC_DIR_PATH", "")
+ + os.environ.get("AUTOBOOT_FFDC_PREFIX", "")
+ + "PEL_logs_list.json"
+ )
if not os.path.isfile(pel_txt_file_path):
- qprint_timen("The following file was not present so no further"
- + " action will be taken.")
+ qprint_timen(
+ "The following file was not present so no further"
+ + " action will be taken."
+ )
qprint_var(pel_txt_file_path)
return
@@ -161,8 +208,9 @@
# If pel_stop_file_path is unqualified and cannot be found, pre-pend
# default_stop_dir_path for the user.
pel_stop_file_path = os.environ.get("STOP_PEL_STOP_FILE_PATH", "")
- if not os.path.isfile(pel_stop_file_path) and \
- os.path.isfile(default_stop_dir_path + pel_stop_file_path):
+ if not os.path.isfile(pel_stop_file_path) and os.path.isfile(
+ default_stop_dir_path + pel_stop_file_path
+ ):
pel_stop_file_path = default_stop_dir_path + pel_stop_file_path
qprint_timen("Using default stop file path.")
qprint_var(pel_stop_file_path)
@@ -171,28 +219,31 @@
pel_stop_list = file_to_list(pel_stop_file_path, newlines=0, comments=0)
if len(pel_stop_list) == 0:
- print_timen("There are no records to process in "
- + pel_stop_file_path + ".")
+ print_timen(
+ "There are no records to process in " + pel_stop_file_path + "."
+ )
return
pel_all_list = file_to_list(pel_txt_file_path, newlines=0, comments=0)
if len(pel_all_list) == 0:
- print_timen("There are no records to process in "
- + pel_txt_file_path + ".")
+ print_timen(
+ "There are no records to process in " + pel_txt_file_path + "."
+ )
return
for stop_pel in pel_stop_list:
for pel_all in pel_all_list:
pel_match = re.search(".*SRC.*" + stop_pel + ".*", pel_all)
if pel_match:
- print_timen("The caller wishes to stop test execution based on "
- + "the presence of certain PEL entries.")
+ print_timen(
+ "The caller wishes to stop test execution based on "
+ + "the presence of certain PEL entries."
+ )
stop_check()
def main():
-
gen_setup()
print_plug_in_header()
@@ -217,10 +268,13 @@
pel_stop_check()
if STOP_VERIFY_HARDWARE_FAIL:
- hardware_error_found = restore_plug_in_value(0, 'Verify_hardware')
+ hardware_error_found = restore_plug_in_value(0, "Verify_hardware")
if hardware_error_found:
- print_timen("The caller wishes to stop test execution when the Verify_hardware plug-in detects a"
- + " hardware error.")
+ print_timen(
+ "The caller wishes to stop test execution when the"
+ " Verify_hardware plug-in detects a"
+ + " hardware error."
+ )
stop_check()
qprint_timen("The caller does not wish to stop the test run.")
diff --git a/bin/print_ffdc_functions b/bin/print_ffdc_functions
index 7988195..632841c 100755
--- a/bin/print_ffdc_functions
+++ b/bin/print_ffdc_functions
@@ -9,10 +9,10 @@
save_path_0 = sys.path[0]
del sys.path[0]
-from gen_arg import * # NOQA
-from gen_print import * # NOQA
-from gen_valid import * # NOQA
-from openbmc_ffdc_list import * # NOQA
+from gen_arg import * # NOQA
+from gen_print import * # NOQA
+from gen_valid import * # NOQA
+from openbmc_ffdc_list import * # NOQA
# Restore sys.path[0].
sys.path.insert(0, save_path_0)
@@ -22,8 +22,12 @@
parser = argparse.ArgumentParser(
usage="%(prog)s [OPTIONS]",
- description="%(prog)s will print a colon-delimited list of all valid OBMC FFDC functions.\n\nExample:"
- + "\n\n\nDump Log:FFDC Generic Report:Get Request FFDC:SEL Log:BMC Specific Files:Sys Inventory Files"
+ description=(
+ "%(prog)s will print a colon-delimited list of all valid OBMC FFDC"
+ " functions.\n\nExample:"
+ )
+ + "\n\n\nDump Log:FFDC Generic Report:Get Request FFDC:SEL Log:BMC"
+ " Specific Files:Sys Inventory Files"
+ ":Core Files:OS FFDC:Dump Files",
formatter_class=argparse.RawDescriptionHelpFormatter,
prefix_chars="-+",
@@ -68,7 +72,6 @@
def main():
-
gen_get_options(parser, stock_list)
validate_parms()
diff --git a/bin/process_plug_in_packages.py b/bin/process_plug_in_packages.py
index bd389c8..febbd53 100755
--- a/bin/process_plug_in_packages.py
+++ b/bin/process_plug_in_packages.py
@@ -4,13 +4,20 @@
See help text for details.
"""
-import sys
-import subprocess
import os
+import subprocess
+import sys
save_dir_path = sys.path.pop(0)
-modules = ['gen_arg', 'gen_print', 'gen_valid', 'gen_plug_in', 'gen_cmd', 'gen_misc']
+modules = [
+ "gen_arg",
+ "gen_print",
+ "gen_valid",
+ "gen_plug_in",
+ "gen_cmd",
+ "gen_misc",
+]
for module in modules:
exec("from " + module + " import *")
@@ -18,98 +25,105 @@
# Create parser object.
parser = argparse.ArgumentParser(
- usage='%(prog)s [OPTIONS]',
+ usage="%(prog)s [OPTIONS]",
description="%(prog)s will process the plug-in packages passed to it."
- + " A plug-in package is essentially a directory containing"
- + " one or more call point programs. Each of these call point"
- + " programs must have a prefix of \"cp_\". When calling"
- + " %(prog)s, a user must provide a call_point parameter"
- + " (described below). For each plug-in package passed,"
- + " %(prog)s will check for the presence of the specified call"
- + " point program in the plug-in directory. If it is found,"
- + " %(prog)s will run it. It is the responsibility of the"
- + " caller to set any environment variables needed by the call"
- + " point programs.\n\nAfter each call point program"
- + " has been run, %(prog)s will print the following values in"
- + " the following formats for use by the calling program:\n"
- + " failed_plug_in_name: <failed plug-in value,"
- + " if any>\n shell_rc: "
- + "<shell return code value of last call point program - this"
- + " will be printed in hexadecimal format. Also, be aware"
- + " that if a call point program returns a value it will be"
- + " shifted left 2 bytes (e.g. rc of 2 will be printed as"
- + " 0x00000200). That is because the rightmost byte is"
- + " reserved for errors in calling the call point program"
- + " rather than errors generated by the call point program.>",
+ + " A plug-in package is essentially a directory containing"
+ + " one or more call point programs. Each of these call point"
+ + ' programs must have a prefix of "cp_". When calling'
+ + " %(prog)s, a user must provide a call_point parameter"
+ + " (described below). For each plug-in package passed,"
+ + " %(prog)s will check for the presence of the specified call"
+ + " point program in the plug-in directory. If it is found,"
+ + " %(prog)s will run it. It is the responsibility of the"
+ + " caller to set any environment variables needed by the call"
+ + " point programs.\n\nAfter each call point program"
+ + " has been run, %(prog)s will print the following values in"
+ + " the following formats for use by the calling program:\n"
+ + " failed_plug_in_name: <failed plug-in value,"
+ + " if any>\n shell_rc: "
+ + "<shell return code value of last call point program - this"
+ + " will be printed in hexadecimal format. Also, be aware"
+ + " that if a call point program returns a value it will be"
+ + " shifted left 2 bytes (e.g. rc of 2 will be printed as"
+ + " 0x00000200). That is because the rightmost byte is"
+ + " reserved for errors in calling the call point program"
+ + " rather than errors generated by the call point program.>",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
- prefix_chars='-+')
+ prefix_chars="-+",
+)
# Create arguments.
parser.add_argument(
- 'plug_in_dir_paths',
- nargs='?',
+ "plug_in_dir_paths",
+ nargs="?",
default="",
- help=plug_in_dir_paths_help_text + default_string)
+ help=plug_in_dir_paths_help_text + default_string,
+)
parser.add_argument(
- '--call_point',
+ "--call_point",
default="setup",
required=True,
- help='The call point program name. This value must not include the'
- + ' "cp_" prefix. For each plug-in package passed to this program,'
- + ' the specified call_point program will be called if it exists in'
- + ' the plug-in directory.' + default_string)
+ help="The call point program name. This value must not include the"
+ + ' "cp_" prefix. For each plug-in package passed to this program,'
+ + " the specified call_point program will be called if it exists in"
+ + " the plug-in directory."
+ + default_string,
+)
parser.add_argument(
- '--allow_shell_rc',
+ "--allow_shell_rc",
default="0x00000000",
- help='The user may supply a value other than zero to indicate an'
- + ' acceptable non-zero return code. For example, if this value'
- + ' equals 0x00000200, it means that for each plug-in call point that'
- + ' runs, a 0x00000200 will not be counted as a failure. See note'
- + ' above regarding left-shifting of return codes.' + default_string)
+ help="The user may supply a value other than zero to indicate an"
+ + " acceptable non-zero return code. For example, if this value"
+ + " equals 0x00000200, it means that for each plug-in call point that"
+ + " runs, a 0x00000200 will not be counted as a failure. See note"
+ + " above regarding left-shifting of return codes."
+ + default_string,
+)
parser.add_argument(
- '--stop_on_plug_in_failure',
+ "--stop_on_plug_in_failure",
default=1,
type=int,
choices=[1, 0],
- help='If this parameter is set to 1, this program will stop and return '
- + 'non-zero if the call point program from any plug-in directory '
- + 'fails. Conversely, if it is set to false, this program will run '
- + 'the call point program from each and every plug-in directory '
- + 'regardless of their return values. Typical example cases where '
- + 'you\'d want to run all plug-in call points regardless of success '
- + 'or failure would be "cleanup" or "ffdc" call points.')
+ help="If this parameter is set to 1, this program will stop and return "
+ + "non-zero if the call point program from any plug-in directory "
+ + "fails. Conversely, if it is set to false, this program will run "
+ + "the call point program from each and every plug-in directory "
+ + "regardless of their return values. Typical example cases where "
+ + "you'd want to run all plug-in call points regardless of success "
+ + 'or failure would be "cleanup" or "ffdc" call points.',
+)
parser.add_argument(
- '--stop_on_non_zero_rc',
+ "--stop_on_non_zero_rc",
default=0,
type=int,
choices=[1, 0],
- help='If this parm is set to 1 and a plug-in call point program returns '
- + 'a valid non-zero return code (see "allow_shell_rc" parm above),'
- + ' this program will stop processing and return 0 (success). Since'
- + ' this constitutes a successful exit, this would normally be used'
- + ' where the caller wishes to stop processing if one of the plug-in'
- + ' directory call point programs returns a special value indicating'
- + ' that some special case has been found. An example might be in'
- + ' calling some kind of "check_errl" call point program. Such a'
- + ' call point program might return a 2 (i.e. 0x00000200) to indicate'
- + ' that a given error log entry was found in an "ignore" list and is'
- + ' therefore to be ignored. That being the case, no other'
- + ' "check_errl" call point program would need to be called.'
- + default_string)
+ help="If this parm is set to 1 and a plug-in call point program returns "
+ + 'a valid non-zero return code (see "allow_shell_rc" parm above),'
+ + " this program will stop processing and return 0 (success). Since"
+ + " this constitutes a successful exit, this would normally be used"
+ + " where the caller wishes to stop processing if one of the plug-in"
+ + " directory call point programs returns a special value indicating"
+ + " that some special case has been found. An example might be in"
+ + ' calling some kind of "check_errl" call point program. Such a'
+ + " call point program might return a 2 (i.e. 0x00000200) to indicate"
+ + ' that a given error log entry was found in an "ignore" list and is'
+ + " therefore to be ignored. That being the case, no other"
+ + ' "check_errl" call point program would need to be called.'
+ + default_string,
+)
parser.add_argument(
- '--mch_class',
- default="obmc",
- help=mch_class_help_text + default_string)
+ "--mch_class", default="obmc", help=mch_class_help_text + default_string
+)
# Populate stock_list with options we want.
stock_list = [("test_mode", 0), ("quiet", 1), ("debug", 0)]
-original_path = os.environ.get('PATH')
+original_path = os.environ.get("PATH")
def validate_parms():
@@ -127,9 +141,7 @@
set_pgm_arg(allow_shell_rc)
-def run_pgm(plug_in_dir_path,
- call_point,
- allow_shell_rc):
+def run_pgm(plug_in_dir_path, call_point, allow_shell_rc):
r"""
Run the call point program in the given plug_in_dir_path. Return the following:
rc The return code - 0 = PASS, 1 = FAIL.
@@ -159,8 +171,10 @@
# No such call point in this plug in dir path. This is legal so we return 0, etc.
return rc, shell_rc, failed_plug_in_name
- print("------------------------------------------------- Starting plug-"
- + "in -----------------------------------------------")
+ print(
+ "------------------------------------------------- Starting plug-"
+ + "in -----------------------------------------------"
+ )
print_timen("Running " + plug_in_name + "/" + cp_prefix + call_point + ".")
@@ -170,26 +184,36 @@
else:
auto_status_file_prefix = ""
auto_status_file_prefix += plug_in_name + ".cp_" + call_point
- status_dir_path =\
- add_trailing_slash(os.environ.get("STATUS_DIR_PATH",
- os.environ['HOME']
- + "/status/"))
+ status_dir_path = add_trailing_slash(
+ os.environ.get("STATUS_DIR_PATH", os.environ["HOME"] + "/status/")
+ )
if not os.path.isdir(status_dir_path):
- AUTOBOOT_EXECDIR = \
- add_trailing_slash(os.environ.get("AUTOBOOT_EXECDIR", ""))
+ AUTOBOOT_EXECDIR = add_trailing_slash(
+ os.environ.get("AUTOBOOT_EXECDIR", "")
+ )
status_dir_path = AUTOBOOT_EXECDIR + "logs/"
if not os.path.exists(status_dir_path):
os.makedirs(status_dir_path)
- status_file_name = auto_status_file_prefix + "." + file_date_time_stamp() \
- + ".status"
- auto_status_file_subcmd = "auto_status_file.py --status_dir_path=" \
- + status_dir_path + " --status_file_name=" + status_file_name \
- + " --quiet=1 --show_url=1 --prefix=" \
- + auto_status_file_prefix + " --stdout=" + str(stdout) + " "
+ status_file_name = (
+ auto_status_file_prefix + "." + file_date_time_stamp() + ".status"
+ )
+ auto_status_file_subcmd = (
+ "auto_status_file.py --status_dir_path="
+ + status_dir_path
+ + " --status_file_name="
+ + status_file_name
+ + " --quiet=1 --show_url=1 --prefix="
+ + auto_status_file_prefix
+ + " --stdout="
+ + str(stdout)
+ + " "
+ )
cmd_buf = "PATH=" + plug_in_dir_path.rstrip("/") + ":${PATH}"
print_issuing(cmd_buf)
- os.environ['PATH'] = plug_in_dir_path.rstrip("/") + os.pathsep + original_path
+ os.environ["PATH"] = (
+ plug_in_dir_path.rstrip("/") + os.pathsep + original_path
+ )
cmd_buf = auto_status_file_subcmd + cp_prefix + call_point
print_issuing(cmd_buf)
@@ -205,11 +229,16 @@
failed_plug_in_name = plug_in_name + "/" + cp_prefix + call_point
if failed_plug_in_name != "" and not stdout:
# Use tail to avoid double-printing of status_file_url.
- shell_cmd("tail -n +2 " + status_dir_path + status_file_name, quiet=1,
- print_output=1)
+ shell_cmd(
+ "tail -n +2 " + status_dir_path + status_file_name,
+ quiet=1,
+ print_output=1,
+ )
- print("------------------------------------------------- Ending plug-in"
- + " -------------------------------------------------")
+ print(
+ "------------------------------------------------- Ending plug-in"
+ + " -------------------------------------------------"
+ )
if failed_plug_in_name != "":
print_var(failed_plug_in_name)
print_var(shell_rc, hexa())
@@ -218,10 +247,9 @@
def main():
-
gen_setup()
- set_term_options(term_requests='children')
+ set_term_options(term_requests="children")
# Access program parameter globals.
global plug_in_dir_paths
@@ -230,8 +258,9 @@
global stop_on_plug_in_failure
global stop_on_non_zero_rc
- plug_in_packages_list = return_plug_in_packages_list(plug_in_dir_paths,
- mch_class)
+ plug_in_packages_list = return_plug_in_packages_list(
+ plug_in_dir_paths, mch_class
+ )
qprint_var(plug_in_packages_list)
qprint("\n")
@@ -245,15 +274,18 @@
ret_code = 0
for plug_in_dir_path in plug_in_packages_list:
- rc, shell_rc, failed_plug_in_name = \
- run_pgm(plug_in_dir_path, call_point, allow_shell_rc)
+ rc, shell_rc, failed_plug_in_name = run_pgm(
+ plug_in_dir_path, call_point, allow_shell_rc
+ )
if rc != 0:
ret_code = 1
if stop_on_plug_in_failure:
break
if shell_rc != 0 and stop_on_non_zero_rc:
- qprint_time("Stopping on non-zero shell return code as requested"
- + " by caller.\n")
+ qprint_time(
+ "Stopping on non-zero shell return code as requested"
+ + " by caller.\n"
+ )
break
if ret_code != 0:
diff --git a/bin/prop_call.py b/bin/prop_call.py
index e352d55..9e18f71 100755
--- a/bin/prop_call.py
+++ b/bin/prop_call.py
@@ -16,56 +16,56 @@
my_program --test_mode=y --quiet=n file1 file2 file3
"""
-import sys
import os
+import sys
save_path_0 = sys.path[0]
del sys.path[0]
-from gen_arg import * # NOQA
-from gen_print import * # NOQA
-from gen_valid import * # NOQA
-from gen_misc import * # NOQA
-from gen_cmd import * # NOQA
+from gen_arg import * # NOQA
+from gen_cmd import * # NOQA
+from gen_misc import * # NOQA
+from gen_print import * # NOQA
+from gen_valid import * # NOQA
# Restore sys.path[0].
sys.path.insert(0, save_path_0)
parser = argparse.ArgumentParser(
- usage='%(prog)s [OPTIONS]',
+ usage="%(prog)s [OPTIONS]",
description="%(prog)s will call a program using parameters retrieved"
+ " from the given properties file.",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
- prefix_chars='-+')
+ prefix_chars="-+",
+)
parser.add_argument(
- '--prop_dir_path',
+ "--prop_dir_path",
default=os.environ.get("PROP_DIR_PATH", os.getcwd()),
- help='The path to the directory that contains the properties file.'
+ help="The path to the directory that contains the properties file."
+ ' The default value is environment variable "PROP_DIR_PATH", if'
- + ' set. Otherwise, it is the current working directory.')
+ + " set. Otherwise, it is the current working directory.",
+)
parser.add_argument(
- '--prop_file_name',
- help='The path to a properties file that contains the parameters to'
+ "--prop_file_name",
+ help="The path to a properties file that contains the parameters to"
+ ' pass to the program. If the properties file has a ".properties"'
- + ' extension, the caller need not specify the extension. The format'
- + ' of each line in the properties file should be as follows:'
- + ' <parm_name=parm_value>. Do not quote the parm value. To specify'
+ + " extension, the caller need not specify the extension. The format"
+ + " of each line in the properties file should be as follows:"
+ + " <parm_name=parm_value>. Do not quote the parm value. To specify"
+ ' positional parms, use a parm name of "pos". For example: pos=this'
- ' value')
+ " value",
+)
-parser.add_argument(
- 'program_name',
- help='The name of the program to be run.')
+parser.add_argument("program_name", help="The name of the program to be run.")
# Populate stock_list with options we want.
stock_list = [("test_mode", 0), ("quiet", 1), ("debug", 0)]
-def exit_function(signal_number=0,
- frame=None):
+def exit_function(signal_number=0, frame=None):
r"""
Execute whenever the program ends normally or with the signals that we catch (i.e. TERM, INT).
"""
@@ -76,8 +76,7 @@
qprint_pgm_footer()
-def signal_handler(signal_number,
- frame):
+def signal_handler(signal_number, frame):
r"""
Handle signals. Without a function to catch a SIGTERM or SIGINT, our program would terminate immediately
with return code 143 and without calling our exit_function.
@@ -127,7 +126,6 @@
def main():
-
if not gen_get_options(parser, stock_list):
return False
diff --git a/bin/validate_plug_ins.py b/bin/validate_plug_ins.py
index 8e3ed1d..f5fa18a 100755
--- a/bin/validate_plug_ins.py
+++ b/bin/validate_plug_ins.py
@@ -2,6 +2,7 @@
import os
import sys
+
try:
import __builtin__
except ImportError:
@@ -17,9 +18,9 @@
save_path_0 = sys.path[0]
del sys.path[0]
-from gen_print import * # NOQA
-from gen_arg import * # NOQA
-from gen_plug_in import * # NOQA
+from gen_arg import * # NOQA
+from gen_plug_in import * # NOQA
+from gen_print import * # NOQA
# Restore sys.path[0].
sys.path.insert(0, save_path_0)
@@ -29,32 +30,32 @@
# Create parser object.
parser = argparse.ArgumentParser(
- usage='%(prog)s [OPTIONS] [PLUG_IN_DIR_PATHS]',
+ usage="%(prog)s [OPTIONS] [PLUG_IN_DIR_PATHS]",
description="%(prog)s will validate the plug-in packages passed to it."
- + " It will also print a list of the absolute plug-in"
- + " directory paths for use by the calling program.",
+ + " It will also print a list of the absolute plug-in"
+ + " directory paths for use by the calling program.",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
- prefix_chars='-+')
+ prefix_chars="-+",
+)
# Create arguments.
parser.add_argument(
- 'plug_in_dir_paths',
- nargs='?',
+ "plug_in_dir_paths",
+ nargs="?",
default="",
- help=plug_in_dir_paths_help_text + default_string)
+ help=plug_in_dir_paths_help_text + default_string,
+)
parser.add_argument(
- '--mch_class',
- default="obmc",
- help=mch_class_help_text + default_string)
+ "--mch_class", default="obmc", help=mch_class_help_text + default_string
+)
# The stock_list will be passed to gen_get_options. We populate it with the names of stock parm options we
# want. These stock parms are pre-defined by gen_get_options.
stock_list = [("test_mode", 0), ("quiet", 1), ("debug", 0)]
-def exit_function(signal_number=0,
- frame=None):
+def exit_function(signal_number=0, frame=None):
r"""
Execute whenever the program ends normally or with the signals that we catch (i.e. TERM, INT).
"""
@@ -112,8 +113,9 @@
global plug_in_dir_paths
global mch_class
- plug_in_packages_list = return_plug_in_packages_list(plug_in_dir_paths,
- mch_class)
+ plug_in_packages_list = return_plug_in_packages_list(
+ plug_in_dir_paths, mch_class
+ )
qprint_var(plug_in_packages_list)
# As stated in the help text, this program must print the full paths of each selected plug in.
diff --git a/bin/websocket_monitor.py b/bin/websocket_monitor.py
index 3425057..0f0a5a4 100755
--- a/bin/websocket_monitor.py
+++ b/bin/websocket_monitor.py
@@ -5,18 +5,19 @@
"""
import json
-import sys
-import websocket
import ssl
+import sys
+
import requests
+import websocket
from retrying import retry
save_path_0 = sys.path[0]
del sys.path[0]
-from gen_print import * # NOQA
-from gen_arg import * # NOQA
-from gen_valid import * # NOQA
+from gen_arg import * # NOQA
+from gen_print import * # NOQA
+from gen_valid import * # NOQA
# Restore sys.path[0].
sys.path.insert(0, save_path_0)
@@ -26,37 +27,39 @@
parser = argparse.ArgumentParser(
- usage='%(prog)s [OPTIONS]',
+ usage="%(prog)s [OPTIONS]",
description="%(prog)s will open a websocket session on a remote OpenBMC. "
- + "When an eSEL is created on that BMC, the monitor will receive "
- + "notice over websocket that the eSEL was created "
- + "and it will print a message.",
+ + "When an eSEL is created on that BMC, the monitor will receive "
+ + "notice over websocket that the eSEL was created "
+ + "and it will print a message.",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
- prefix_chars='-+')
+ prefix_chars="-+",
+)
parser.add_argument(
- 'openbmc_host',
- default='',
- help='The BMC host name or IP address.')
+ "openbmc_host", default="", help="The BMC host name or IP address."
+)
parser.add_argument(
- '--openbmc_username',
- default='root',
- help='The userid for the open BMC system.')
+ "--openbmc_username",
+ default="root",
+ help="The userid for the open BMC system.",
+)
parser.add_argument(
- '--openbmc_password',
- default='',
- help='The password for the open BMC system.')
+ "--openbmc_password",
+ default="",
+ help="The password for the open BMC system.",
+)
parser.add_argument(
- '--monitor_type',
- choices=['logging', 'dump'],
- default='logging',
- help='The type of notifications from websocket to monitor.')
+ "--monitor_type",
+ choices=["logging", "dump"],
+ default="logging",
+ help="The type of notifications from websocket to monitor.",
+)
stock_list = [("test_mode", 0), ("quiet", 0), ("debug", 0)]
-def exit_function(signal_number=0,
- frame=None):
+def exit_function(signal_number=0, frame=None):
r"""
Execute whenever the program ends normally or with the signals that we
catch (i.e. TERM, INT).
@@ -67,8 +70,7 @@
qprint_pgm_footer()
-def signal_handler(signal_number,
- frame):
+def signal_handler(signal_number, frame):
r"""
Handle signals. Without a function to catch a SIGTERM or SIGINT, the
program would terminate immediately with return code 143 and without
@@ -95,14 +97,12 @@
valid_value(openbmc_username)
valid_value(openbmc_password)
global monitoring_uri
- monitoring_uri = '/xyz/openbmc_project/' + monitor_type
+ monitoring_uri = "/xyz/openbmc_project/" + monitor_type
gen_post_validation(exit_function, signal_handler)
@retry(stop_max_attempt_number=3, wait_fixed=1000)
-def login(openbmc_host,
- openbmc_username,
- openbmc_password):
+def login(openbmc_host, openbmc_username, openbmc_password):
r"""
Log into the BMC and return the session object.
@@ -114,15 +114,19 @@
qprint_executing()
- http_header = {'Content-Type': 'application/json'}
+ http_header = {"Content-Type": "application/json"}
session = requests.session()
- response = session.post('https://' + openbmc_host + '/login', headers=http_header,
- json={"data": [openbmc_username, openbmc_password]},
- verify=False, timeout=30)
+ response = session.post(
+ "https://" + openbmc_host + "/login",
+ headers=http_header,
+ json={"data": [openbmc_username, openbmc_password]},
+ verify=False,
+ timeout=30,
+ )
valid_value(response.status_code, valid_values=[200])
login_response = json.loads(response.text)
qprint_var(login_response)
- valid_value(login_response['status'], valid_values=['ok'])
+ valid_value(login_response["status"], valid_values=["ok"])
return session
@@ -145,12 +149,14 @@
# or
# /xyz/openbmc_project/dump/entry/1","properties":{"Size":186180}}').
- if monitoring_uri + '/entry' in message:
- if 'Id' in message:
- qprint_timen('eSEL received over websocket interface.')
+ if monitoring_uri + "/entry" in message:
+ if "Id" in message:
+ qprint_timen("eSEL received over websocket interface.")
websocket_obj.close()
- elif 'Size' in message:
- qprint_timen('Dump notification received over websocket interface.')
+ elif "Size" in message:
+ qprint_timen(
+ "Dump notification received over websocket interface."
+ )
websocket_obj.close()
@@ -212,17 +218,23 @@
session = login(openbmc_host, openbmc_username, openbmc_password)
qprint_timen("Registering websocket handlers.")
cookies = session.cookies.get_dict()
- cookies = sprint_var(cookies, fmt=no_header() | strip_brackets(),
- col1_width=0, trailing_char="",
- delim="=").replace("\n", ";")
+ cookies = sprint_var(
+ cookies,
+ fmt=no_header() | strip_brackets(),
+ col1_width=0,
+ trailing_char="",
+ delim="=",
+ ).replace("\n", ";")
# Register the event handlers. When an ESEL is created by the system
# under test, the on_message() handler will be called.
- websocket_obj = websocket.WebSocketApp("wss://" + openbmc_host + "/subscribe",
- on_message=on_message,
- on_error=on_error,
- on_close=on_close,
- on_open=on_open,
- cookie=cookies)
+ websocket_obj = websocket.WebSocketApp(
+ "wss://" + openbmc_host + "/subscribe",
+ on_message=on_message,
+ on_error=on_error,
+ on_close=on_close,
+ on_open=on_open,
+ cookie=cookies,
+ )
qprint_timen("Completed registering of websocket handlers.")
websocket_obj.run_forever(sslopt={"cert_reqs": ssl.CERT_NONE})