Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1922921

Summary: Openstack tripleo validator show run results in KeyError: 'tasks' in validator show
Product: Red Hat OpenStack Reporter: Gaël Chamoulaud <gchamoul>
Component: python-tripleoclientAssignee: Gaël Chamoulaud <gchamoul>
Status: CLOSED ERRATA QA Contact: David Rosenfeld <drosenfe>
Severity: medium Docs Contact:
Priority: high    
Version: 16.1 (Train)CC: cjeanner, hbrock, igallagh, jslagle, mburns, shrjoshi, 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.20201114043245.el8ost Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-03-17 15:36:38 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:

Description Gaël Chamoulaud 2021-02-01 05:47:03 UTC
When running the validation 'show run' subcommand, it fails with an exception KeyError: 'tasks'

> (undercloud) [stack@undercloud-0 ~]$ openstack tripleo validator show run
> 92284b02-0b98-496e-a10b-4d98fe8ea750
> 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 478, in take_action
>     print(json.dumps(p['tasks'],
> KeyError: 'tasks'
> 'tasks'
> (undercloud) [stack@undercloud-0 ~]$

Comment 1 Cédric Jeanneret 2021-02-01 10:04:52 UTC
Patches are locked upstream for now: https://review.opendev.org/q/c8137f8f016e26043903f63b4ec794467b69eea5
need the backports, at least for osp-16.1 - note, osp-16.2 might also be affected since this patch isn't in stable/train - so not yet imported in 16.2-trunk-patches.

Comment 3 Gaël Chamoulaud 2021-02-01 14:37:49 UTC
This issue affects only the failed validations. To show the result of a failed validations, the workaround is:

1- Get the UUID of the latest failed execution for one validation:

(undercloud) [stack@undercloud ~]$ openstack tripleo validator show history --validation check-cpu
+--------------------------------------+-------------+--------+-----------------------------+-------------+
| UUID                                 | Validations | Status | Execution at                | Duration    |
+--------------------------------------+-------------+--------+-----------------------------+-------------+
| 90a4e822-e22f-4c46-9b05-8450d63face0 | check-cpu   | FAILED | 2021-01-10T20:47:13.925997Z | 0:00:09.231 |
| 90a4e822-e22f-4c46-9b05-8450d63face0 | check-cpu   | FAILED | 2021-01-10T20:47:13.926018Z | 0:00:09.231 |
| 1bdb9550-1cbb-464c-9be6-c60836fafe8f | check-cpu   | FAILED | 2021-01-10T20:49:02.385393Z | 0:00:08.913 |
| 1bdb9550-1cbb-464c-9be6-c60836fafe8f | check-cpu   | FAILED | 2021-01-10T20:49:02.385413Z | 0:00:08.913 |
| a7fa2ca5-0c3f-48b7-80e6-bd65fb31e47d | check-cpu   | FAILED | 2021-01-10T20:51:51.025985Z | 0:00:09.017 |
| a7fa2ca5-0c3f-48b7-80e6-bd65fb31e47d | check-cpu   | FAILED | 2021-01-10T20:51:51.026009Z | 0:00:09.017 |
| 37e24b41-6aa3-4ead-8a5b-5497597029dc | check-cpu   | FAILED | 2021-01-10T20:54:07.810340Z | 0:00:09.027 |
| 37e24b41-6aa3-4ead-8a5b-5497597029dc | check-cpu   | FAILED | 2021-01-10T20:54:07.810364Z | 0:00:09.027 |
| da94818a-2f9b-4e30-93cd-92c20d081feb | check-cpu   | FAILED | 2021-01-10T21:04:59.806687Z | 0:00:08.968 |
| da94818a-2f9b-4e30-93cd-92c20d081feb | check-cpu   | FAILED | 2021-01-10T21:04:59.806708Z | 0:00:08.968 |
| 20a55e50-fdcf-45e9-895c-6ccaf369ddf3 | check-cpu   | FAILED | 2021-01-11T07:43:56.063333Z | 0:00:09.355 |
| 20a55e50-fdcf-45e9-895c-6ccaf369ddf3 | check-cpu   | FAILED | 2021-01-11T07:43:56.063385Z | 0:00:09.355 |
| 98d88232-41a0-4667-8134-330b9612bb88 | check-cpu   | FAILED | 2021-01-11T08:41:07.021682Z | 0:00:08.962 |
| 98d88232-41a0-4667-8134-330b9612bb88 | check-cpu   | FAILED | 2021-01-11T08:41:07.021715Z | 0:00:08.962 |
| 33cf63bb-8ff8-4211-a750-07dd44b85077 | check-cpu   | FAILED | 2021-01-11T08:42:43.825164Z | 0:00:08.960 |
| 33cf63bb-8ff8-4211-a750-07dd44b85077 | check-cpu   | FAILED | 2021-01-11T08:42:43.825186Z | 0:00:08.960 |
| 8dcd7602-7e71-4285-8e49-16dc9c8f59c3 | check-cpu   | FAILED | 2021-01-11T10:31:21.179305Z | 0:00:08.964 |
| 8dcd7602-7e71-4285-8e49-16dc9c8f59c3 | check-cpu   | FAILED | 2021-01-11T10:31:21.179327Z | 0:00:08.964 |
| 49d5c386-3ec9-415e-a803-a9d5a997748a | check-cpu   | FAILED | 2021-01-11T10:32:05.372701Z | 0:00:09.043 |
| 49d5c386-3ec9-415e-a803-a9d5a997748a | check-cpu   | FAILED | 2021-01-11T10:32:05.372724Z | 0:00:09.043 |
| 4d2a8d11-595e-4658-8c70-bb0d1d04dd0f | check-cpu   | FAILED | 2021-01-12T10:44:40.958578Z | 0:00:04.023 |
| ca8cf026-c9c6-43e1-92e6-3795e7b2f6a3 | check-cpu   | FAILED | 2021-01-12T10:45:37.160496Z | 0:00:03.598 |
| 00190948-3ad6-0f78-fef5-000000000008 | check-cpu   | FAILED | 2021-01-20T14:22:06.175979Z | 0:00:43.908 |
+--------------------------------------+-------------+--------+-----------------------------+-------------+

2- Copy the UUID of one of those execution and run the following command to show what's happened:

(undercloud) [stack@undercloud ~]$ cat /var/log/validations/ca8cf026-c9c6-43e1-92e6-3795e7b2f6a3_check-cpu_2021-01-12T10\:45\:37.157152Z.json | jq .validation_output
[
  {
    "task": {
      "hosts": {
        "undercloud": {
          "_ansible_no_log": false,
          "action": "fail",
          "changed": false,
          "failed": true,
          "failed_when_result": true,
          "msg": "There are 6 cores in the system, but there should be at least 8"
        }
      },
      "name": "Verify the number of CPU cores",
      "status": "FAILED"
    }
  },
  {
    "task": {
      "hosts": {
        "overcloud-controller-0": {
          "_ansible_no_log": false,
          "action": "fail",
          "changed": false,
          "failed": true,
          "failed_when_result": true,
          "msg": "There are 2 cores in the system, but there should be at least 8"
        }
      },
      "name": "Verify the number of CPU cores",
      "status": "FAILED"
    }
  },
  {
    "task": {
      "hosts": {
        "overcloud-novacompute-0": {
          "_ansible_no_log": false,
          "action": "fail",
          "changed": false,
          "failed": true,
          "failed_when_result": true,
          "msg": "There are 2 cores in the system, but there should be at least 8"
        }
      },
      "name": "Verify the number of CPU cores",
      "status": "FAILED"
    }
  }
]

Comment 4 Cédric Jeanneret 2021-02-10 10:48:12 UTC
Upstream merged - moving to POST.

Comment 7 David Rosenfeld 2021-02-17 20:21:02 UTC
show run for a failed validation may now be executed successfully with no key error:

openstack tripleo validator show history --validation check-cpu | grep FAILED
| 55756ff9-e632-441c-8b29-f55dd5f734ad | check-cpu   | FAILED | 2021-02-17T18:44:35.596464Z | 0:00:02.908 |
| e436082b-cd7c-4e46-9cf0-fea00052286b | check-cpu   | FAILED | 2021-02-17T18:59:25.697356Z | 0:00:02.901 |
| a5756b73-a633-4c99-8c7a-30c4da748691 | check-cpu   | FAILED | 2021-02-17T19:02:06.496793Z | 0:00:02.904 |
| f040c2d0-1097-4238-a3f6-9e707227c5dd | check-cpu   | FAILED | 2021-02-17T19:04:24.977470Z | 0:00:02.901 |
| 1e679f48-1c1c-48aa-b818-2e54fab1bcd2 | check-cpu   | FAILED | 2021-02-17T19:04:43.423993Z | 0:00:03.014 |
(undercloud) [stack@undercloud-0 ~]$ openstack tripleo validator show run 55756ff9-e632-441c-8b29-f55dd5f734ad
{
    "hosts": {
        "compute-0": {
            "_ansible_no_log": false,
            "action": "fail",
            "changed": false,
            "failed": true,
            "failed_when_result": true,
            "msg": "There are 4 cores in the system, but there should be at least 8"
        }
    },
    "name": "Verify the number of CPU cores",
    "status": "FAILED"
}

Comment 9 shreshtha joshi 2021-02-19 13:19:55 UTC
Please clone a separate bug for 16.2 tracking. Please do not add flags to existing bugs.

Comment 14 errata-xmlrpc 2021-03-17 15:36:38 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

Comment 16 Red Hat Bugzilla 2023-09-15 00:59:38 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 500 days