Bug 1887437

Summary: IndexError: list index out of range when using an empty validation group in "run" subcommand
Product: Red Hat OpenStack Reporter: Cédric Jeanneret <cjeanner>
Component: python-tripleoclientAssignee: mathieu bultel <mbultel>
Status: CLOSED ERRATA QA Contact: David Rosenfeld <drosenfe>
Severity: medium Docs Contact:
Priority: high    
Version: 16.1 (Train)CC: gchamoul, hbrock, jbuchta, jschluet, jslagle, mburns, slinaber, spower
Target Milestone: z4Keywords: Triaged
Target Release: 16.1 (Train on RHEL 8.2)   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-tripleoclient-12.3.2-1.20200914164931.el8ost Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-03-17 15:32:20 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1912879    
Bug Blocks:    

Description Cédric Jeanneret 2020-10-12 13:27:36 UTC
Description of problem:

Running `openstack tripleo validator run --group some-group' returns a stack trace if no validation is present in "some-group". For instance:

openstack tripleo validator run --group post-overcloud-prepare
Exception occured while running the command
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/tripleoclient/command.py", line 32, in run
    super(Command, self).run(parsed_args)
  File "/usr/lib/python3.6/site-packages/osc_lib/command/command.py", line 41, in run
    return super(Command, self).run(parsed_args)
  File "/usr/lib/python3.6/site-packages/cliff/command.py", line 185, in run
    return_code = self.take_action(parsed_args) or 0
  File "/usr/lib/python3.6/site-packages/tripleoclient/v1/tripleo_validator.py", line 388, in take_action
    self._run_validator_run(parsed_args)
  File "/usr/lib/python3.6/site-packages/tripleoclient/v1/tripleo_validator.py", line 364, in _run_validator_run
    t.field_names = results[0].keys()
IndexError: list index out of range
list index out of range


Version-Release number of selected component (if applicable):
python3-validations-libs-1.0.5-1.20200914174429.4a660ec.el8ost.noarch

How reproducible:
Always

Steps to Reproduce:
1. deploy an undercloud
2. try running a group without any validation in it
3.

Actual results:
A stacktrace is shown

Expected results:
A message saying "no validation in that group" or something should be shown

Additional info:
Detected during downstream CI checks - thanks David R and Jad!

Comment 6 David Rosenfeld 2021-01-25 13:29:23 UTC
Verification of this BZ is blocked by https://bugzilla.redhat.com/show_bug.cgi?id=1912879

Comment 9 David Rosenfeld 2021-02-04 19:18:25 UTC
index error is no longer seen. A message is now printed:

openstack tripleo validator run --group post-overcloud-prepare
Running Validations without Overcloud settings.
WARNING:tripleo_common.inventory:Stack not found: overcloud. Only the undercloud will be added to the inventory.
No Validation has been run, please check your parameters.

Comment 15 errata-xmlrpc 2021-03-17 15:32:20 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Red Hat OpenStack Platform 16.1.4 director bug fix advisory), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:0817