Update CLI documentation and shorten sub options
Change-Id: I615d2697cd86d964c3e19c3641a154700bc5ec0e
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/ffdc/collect_ffdc.py b/ffdc/collect_ffdc.py
index e783e0c..d52b1ec 100644
--- a/ffdc/collect_ffdc.py
+++ b/ffdc/collect_ffdc.py
@@ -22,40 +22,39 @@
@click.command(context_settings=dict(help_option_names=['-h', '--help']))
-@click.option('-r', '--remote', envvar='OPENBMC_HOST',
- help="Name/IP of the remote (targeting) host. [default: OPENBMC_HOST]")
-@click.option('-u', '--username', envvar='OPENBMC_USERNAME',
- help="User on the remote host with access to FFDC files.[default: OPENBMC_USERNAME]")
-@click.option('-p', '--password', envvar='OPENBMC_PASSWORD',
- help="Password for user on remote host. [default: OPENBMC_PASSWORD]")
-@click.option('-c', '--ffdc_config', default=abs_path + "/ffdc_config.yaml",
- show_default=True, help="YAML Configuration file listing commands and files for FFDC.")
+@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 store collected FFDC data")
-@click.option('-t', '--remote_type',
+ 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', '--remote_protocol', default="ALL",
+@click.option('-rp', '--protocol', default="ALL",
show_default=True,
- help="Select protocol (SSH, SCP, REDFISH) to communicate with remote host. \
- Default: all available.")
+ help="Select protocol to communicate with remote host.")
@click.option('-e', '--env_vars', show_default=True,
- help="Environment variables as dictionary e.g: {'var':value}")
+ help="Environment variables e.g: {'var':value}")
@click.option('--log_level', default="INFO",
show_default=True,
- help="python logging level (CRITICAL, ERROR, WARNING, INFO, DEBUG)")
+ help="Log level (CRITICAL, ERROR, WARNING, INFO, DEBUG)")
def cli_ffdc(remote, username, password,
- ffdc_config, location, remote_type,
- remote_protocol, env_vars, log_level):
+ config, location, type,
+ protocol, env_vars, log_level):
r"""
Stand alone CLI to generate and collect FFDC from the selected target.
"""
click.echo("\n********** FFDC (First Failure Data Collection) Starts **********")
- if input_options_ok(remote, username, password, ffdc_config, remote_type):
+ if input_options_ok(remote, username, password, config, type):
thisFFDC = FFDCCollector(remote, username, password,
- ffdc_config, location, remote_type,
- remote_protocol, env_vars, log_level)
+ config, location, type,
+ protocol, env_vars, log_level)
thisFFDC.collect_ffdc()
if len(os.listdir(thisFFDC.ffdc_dir_path)) == 0:
@@ -69,7 +68,7 @@
click.echo("\n********** FFDC Finishes **********\n\n")
-def input_options_ok(remote, username, password, ffdc_config, remote_type):
+def input_options_ok(remote, username, password, config, type):
r"""
Verify script options exist via CLI options or environment variables.
"""
@@ -89,14 +88,14 @@
print("\
\n\tERROR: Password for user on remote host is not specified in CLI options "
+ "or env OPENBMC_PASSWORD.")
- if not remote_type:
+ if not type:
all_options_ok = False
print("\
\n\tERROR: Remote host os type is not specified in CLI options.")
- if not os.path.isfile(ffdc_config):
+ if not os.path.isfile(config):
all_options_ok = False
print("\
- \n\tERROR: Config file %s is not found. Please verify path and filename." % ffdc_config)
+ \n\tERROR: Config file %s is not found. Please verify path and filename." % config)
return all_options_ok