Revert "black: re-format"
This reverts commit 5731818de0ce446ceaafc7e75ae39da1b69942ae.
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
Change-Id: Ie61cdc8c7f2825b0d9d66be87a6a3a058de2b372
diff --git a/ffdc/collect_ffdc.py b/ffdc/collect_ffdc.py
index 09b4be8..ca232f1 100644
--- a/ffdc/collect_ffdc.py
+++ b/ffdc/collect_ffdc.py
@@ -4,16 +4,16 @@
CLI FFDC Collector.
"""
+from ffdc_collector import ffdc_collector
+
import os
import sys
-
import click
-from ffdc_collector import ffdc_collector
# ---------Set sys.path for cli command execution---------------------------------------
# Absolute path to openbmc-test-automation/ffdc
abs_path = os.path.abspath(os.path.dirname(sys.argv[0]))
-full_path = abs_path.split("ffdc")[0]
+full_path = abs_path.split('ffdc')[0]
sys.path.append(full_path)
# Walk path and append to sys.path
@@ -22,105 +22,63 @@
sys.path.append(os.path.join(root, found_dir))
-@click.command(context_settings=dict(help_option_names=["-h", "--help"]))
-@click.option("-r", "--remote", help="Hostname/IP of the remote host")
-@click.option("-u", "--username", help="Username of the remote host.")
-@click.option("-p", "--password", help="Password of the remote host.")
-@click.option(
- "-c",
- "--config",
- default=abs_path + "/ffdc_config.yaml",
- show_default=True,
- help="YAML Configuration file for log collection.",
-)
-@click.option(
- "-l",
- "--location",
- default="/tmp",
- show_default=True,
- help="Location to save logs",
-)
-@click.option(
- "-t",
- "--type",
- help=(
- "OS type of the remote (targeting) host. OPENBMC, RHEL, UBUNTU,"
- " SLES, AIX"
- ),
-)
-@click.option(
- "-rp",
- "--protocol",
- default="ALL",
- show_default=True,
- help="Select protocol to communicate with remote host.",
-)
-@click.option(
- "-e",
- "--env_vars",
- show_default=True,
- help="Environment variables e.g: {'var':value}",
-)
-@click.option(
- "-ec",
- "--econfig",
- show_default=True,
- help="Predefine environment variables, refer en_vars_template.yaml ",
-)
-@click.option(
- "--log_level",
- default="INFO",
- show_default=True,
- help="Log level (CRITICAL, ERROR, WARNING, INFO, DEBUG)",
-)
-def cli_ffdc(
- remote,
- username,
- password,
- config,
- location,
- type,
- protocol,
- env_vars,
- econfig,
- log_level,
-):
+@click.command(context_settings=dict(help_option_names=['-h', '--help']))
+@click.option('-r', '--remote',
+ help="Hostname/IP of the remote host")
+@click.option('-u', '--username',
+ help="Username of the remote host.")
+@click.option('-p', '--password',
+ help="Password of the remote host.")
+@click.option('-c', '--config', default=abs_path + "/ffdc_config.yaml",
+ show_default=True, help="YAML Configuration file for log collection.")
+@click.option('-l', '--location', default="/tmp",
+ show_default=True, help="Location to save logs")
+@click.option('-t', '--type',
+ help="OS type of the remote (targeting) host. OPENBMC, RHEL, UBUNTU, SLES, AIX")
+@click.option('-rp', '--protocol', default="ALL",
+ show_default=True,
+ help="Select protocol to communicate with remote host.")
+@click.option('-e', '--env_vars', show_default=True,
+ help="Environment variables e.g: {'var':value}")
+@click.option('-ec', '--econfig', show_default=True,
+ help="Predefine environment variables, refer en_vars_template.yaml ")
+@click.option('--log_level', default="INFO",
+ show_default=True,
+ help="Log level (CRITICAL, ERROR, WARNING, INFO, DEBUG)")
+def cli_ffdc(remote,
+ username,
+ password,
+ config,
+ location,
+ type,
+ protocol,
+ env_vars,
+ econfig,
+ log_level):
r"""
Stand alone CLI to generate and collect FFDC from the selected target.
"""
- click.echo(
- "\n********** FFDC (First Failure Data Collection) Starts **********"
- )
+ click.echo("\n********** FFDC (First Failure Data Collection) Starts **********")
if input_options_ok(remote, username, password, config, type):
- this_ffdc = ffdc_collector(
- remote,
- username,
- password,
- config,
- location,
- type,
- protocol,
- env_vars,
- econfig,
- log_level,
- )
+ this_ffdc = ffdc_collector(remote,
+ username,
+ password,
+ config,
+ location,
+ type,
+ protocol,
+ env_vars,
+ econfig,
+ log_level)
this_ffdc.collect_ffdc()
if len(os.listdir(this_ffdc.ffdc_dir_path)) == 0:
- click.echo(
- "\n\tFFDC Collection from " + remote + " has failed.\n\n"
- )
+ click.echo("\n\tFFDC Collection from " + remote + " has failed.\n\n")
else:
- click.echo(
- str(
- "\n\t"
- + str(len(os.listdir(this_ffdc.ffdc_dir_path)))
- + " files were retrieved from "
- + remote
- )
- )
+ click.echo(str("\n\t" + str(len(os.listdir(this_ffdc.ffdc_dir_path)))
+ + " files were retrieved from " + remote))
click.echo("\tFiles are stored in " + this_ffdc.ffdc_dir_path)
click.echo("\tTotal elapsed time " + this_ffdc.elapsed_time + "\n\n")
@@ -136,37 +94,27 @@
if not remote:
all_options_ok = False
- print(
- " \n\tERROR: Name/IP of the remote host is not specified in"
- " CLI options."
- )
+ print("\
+ \n\tERROR: Name/IP of the remote host is not specified in CLI options.")
if not username:
all_options_ok = False
- print(
- " \n\tERROR: User of the remote host is not specified in"
- " CLI options."
- )
+ print("\
+ \n\tERROR: User of the remote host is not specified in CLI options.")
if not password:
all_options_ok = False
- print(
- " \n\tERROR: Password of the user remote host is not"
- " specified in CLI options."
- )
+ print("\
+ \n\tERROR: Password of the user remote host is not specified in CLI options.")
if not type:
all_options_ok = False
- print(
- " \n\tERROR: Remote host os type is not specified in CLI"
- " options."
- )
+ print("\
+ \n\tERROR: Remote host os type is not specified in CLI options.")
if not os.path.isfile(config):
all_options_ok = False
- print(
- " \n\tERROR: Config file %s is not found. Please verify"
- " path and filename." % config
- )
+ print("\
+ \n\tERROR: Config file %s is not found. Please verify path and filename." % config)
return all_options_ok
-if __name__ == "__main__":
+if __name__ == '__main__':
cli_ffdc()