Revert "black: re-format"
This reverts commit 5731818de0ce446ceaafc7e75ae39da1b69942ae.
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
Change-Id: Ie61cdc8c7f2825b0d9d66be87a6a3a058de2b372
diff --git a/lib/ffdc_cli_robot_script.py b/lib/ffdc_cli_robot_script.py
index 5d2cd18..eb2cb2e 100644
--- a/lib/ffdc_cli_robot_script.py
+++ b/lib/ffdc_cli_robot_script.py
@@ -3,10 +3,12 @@
import os
import sys
+
from ffdc_collector import ffdc_collector
-from robot.libraries.BuiltIn import BuiltIn as robotBuildIn
from ssh_utility import SSHRemoteclient
+from robot.libraries.BuiltIn import BuiltIn as robotBuildIn
+
sys.path.append(__file__.split(__file__.split("/")[-1])[0] + "../ffdc")
# (Sub) String constants used for input dictionary key search
@@ -74,15 +76,12 @@
# 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)
@@ -155,10 +154,7 @@
# 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:
@@ -179,83 +175,76 @@
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()