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.
Change-Id: If1010ead857d41364c024bf8145a979a9377d382
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/lib/ffdc_cli_robot_script.py b/lib/ffdc_cli_robot_script.py
index eb2cb2e..5d2cd18 100644
--- a/lib/ffdc_cli_robot_script.py
+++ b/lib/ffdc_cli_robot_script.py
@@ -3,11 +3,9 @@
import os
import sys
-
from ffdc_collector import ffdc_collector
-from ssh_utility import SSHRemoteclient
-
from robot.libraries.BuiltIn import BuiltIn as robotBuildIn
+from ssh_utility import SSHRemoteclient
sys.path.append(__file__.split(__file__.split("/")[-1])[0] + "../ffdc")
@@ -76,12 +74,15 @@
# When method is invoked with no parm,
# use robot variables
# OPENBMC_HOST, OPENBMC_USERNAME, OPENBMC_PASSWORD, OPENBMC (type)
- dict_of_parms["OPENBMC_HOST"] = \
- robotBuildIn().get_variable_value("${OPENBMC_HOST}", default=None)
- dict_of_parms["OPENBMC_USERNAME"] = \
- robotBuildIn().get_variable_value("${OPENBMC_USERNAME}", default=None)
- dict_of_parms["OPENBMC_PASSWORD"] = \
- robotBuildIn().get_variable_value("${OPENBMC_PASSWORD}", default=None)
+ dict_of_parms["OPENBMC_HOST"] = robotBuildIn().get_variable_value(
+ "${OPENBMC_HOST}", default=None
+ )
+ dict_of_parms["OPENBMC_USERNAME"] = robotBuildIn().get_variable_value(
+ "${OPENBMC_USERNAME}", default=None
+ )
+ dict_of_parms["OPENBMC_PASSWORD"] = robotBuildIn().get_variable_value(
+ "${OPENBMC_PASSWORD}", default=None
+ )
dict_of_parms["REMOTE_TYPE"] = "OPENBMC"
run_ffdc_collector(dict_of_parms)
@@ -154,7 +155,10 @@
# that are not specified with input and have acceptable defaults.
if not location:
# Default FFDC store location
- location = robotBuildIn().get_variable_value("${EXECDIR}", default=None) + "/logs"
+ location = (
+ robotBuildIn().get_variable_value("${EXECDIR}", default=None)
+ + "/logs"
+ )
ffdc_collector.validate_local_store(location)
if not config:
@@ -175,76 +179,83 @@
log_level = "INFO"
# If minimum required inputs are met, go collect.
- if (remote and username and password and remote_type):
+ if remote and username and password and remote_type:
# Execute data collection
- this_ffdc = ffdc_collector(remote,
- username,
- password,
- config,
- location,
- remote_type,
- protocol,
- env_vars,
- econfig,
- log_level)
+ this_ffdc = ffdc_collector(
+ remote,
+ username,
+ password,
+ config,
+ location,
+ remote_type,
+ protocol,
+ env_vars,
+ econfig,
+ log_level,
+ )
this_ffdc.collect_ffdc()
# If original ffdc request is for BMC,
# attempt to also collect ffdc for HOST_OS if possible.
- if remote_type.upper() == 'OPENBMC':
- os_host = \
- robotBuildIn().get_variable_value("${OS_HOST}", default=None)
- os_username = \
- robotBuildIn().get_variable_value("${OS_USERNAME}", default=None)
- os_password = \
- robotBuildIn().get_variable_value("${OS_PASSWORD}", default=None)
+ if remote_type.upper() == "OPENBMC":
+ os_host = robotBuildIn().get_variable_value(
+ "${OS_HOST}", default=None
+ )
+ os_username = robotBuildIn().get_variable_value(
+ "${OS_USERNAME}", default=None
+ )
+ os_password = robotBuildIn().get_variable_value(
+ "${OS_PASSWORD}", default=None
+ )
if os_host and os_username and os_password:
os_type = get_os_type(os_host, os_username, os_password)
if os_type:
- os_ffdc = ffdc_collector(os_host,
- os_username,
- os_password,
- config,
- location,
- os_type,
- protocol,
- env_vars,
- econfig,
- log_level)
+ os_ffdc = ffdc_collector(
+ os_host,
+ os_username,
+ os_password,
+ config,
+ location,
+ os_type,
+ protocol,
+ env_vars,
+ econfig,
+ log_level,
+ )
os_ffdc.collect_ffdc()
def get_os_type(os_host, os_username, os_password):
-
os_type = None
# If HOST_OS is pingable
if os.system("ping -c 1 " + os_host) == 0:
r"""
- Open a ssh connection to targeted system.
+ Open a ssh connection to targeted system.
"""
- ssh_remoteclient = SSHRemoteclient(os_host,
- os_username,
- os_password)
+ ssh_remoteclient = SSHRemoteclient(os_host, os_username, os_password)
if ssh_remoteclient.ssh_remoteclient_login():
-
# Find OS_TYPE
- cmd_exit_code, err, response = \
- ssh_remoteclient.execute_command('uname')
+ cmd_exit_code, err, response = ssh_remoteclient.execute_command(
+ "uname"
+ )
os_type = response.strip()
# If HOST_OS is linux, expands os_type to one of
# the 2 linux distros that have more details in ffdc_config.yaml
- if os_type.upper() == 'LINUX':
- cmd_exit_code, err, response = \
- ssh_remoteclient.execute_command('cat /etc/os-release')
+ if os_type.upper() == "LINUX":
+ (
+ cmd_exit_code,
+ err,
+ response,
+ ) = ssh_remoteclient.execute_command("cat /etc/os-release")
linux_distro = response
- if 'redhat' in linux_distro:
- os_type = 'RHEL'
- elif 'ubuntu' in linux_distro:
- os_type = 'UBUNTU'
+ if "redhat" in linux_distro:
+ os_type = "RHEL"
+ elif "ubuntu" in linux_distro:
+ os_type = "UBUNTU"
if ssh_remoteclient:
ssh_remoteclient.ssh_remoteclient_disconnect()