Red Hat Bugzilla – Bug 1619563
Health check met python KeyError: 'resources'
Last modified: 2018-10-11 03:25:43 EDT
Description of problem: Run health check met python KeyError: 'resources'. Version-Release number of the following components: openshift-ansible-3.11.0-0.17.0.git.0.d3888d7None.noarch ansible-2.6.2-1.el7ae.noarch How reproducible: 100% Steps to Reproduce: 1. Setup a OCP cluster 2. Execute health check # ansible-playbook -i inventory -vv /usr/share/ansible/openshift-ansible/playbooks/openshift-checks/health.yml 3. Actual results: # ansible-playbook -i inventory -vv /usr/share/ansible/openshift-ansible/playbooks/openshift-checks/health.yml ... check "sdn": 'resources' Traceback (most recent call last): File "/usr/share/ansible/openshift-ansible/roles/openshift_health_checker/action_plugins/openshift_health_check.py", line 225, in run_check result = check.run() File "/usr/share/ansible/openshift-ansible/roles/openshift_health_checker/openshift_checks/sdn.py", line 69, in run self.check_master() File "/usr/share/ansible/openshift-ansible/roles/openshift_health_checker/openshift_checks/sdn.py", line 160, in check_master nodes = self.get_resource('nodes') File "/usr/share/ansible/openshift-ansible/roles/openshift_health_checker/openshift_checks/sdn.py", line 214, in get_resource for resource in self.task_vars['resources']['results']: KeyError: 'resources' ... Expected results: Installer shouldn't never print out python error whatever the cluster is healthy or not. Additional info:
The issue is that the openshift-checks/health.yml playbook was not getting cluster resources before running the health checks. The openshift-checks/adhoc.yml playbook does do this, and we want to be able to run the SDN check using either playbook, so I copied the relevant code from the adhoc playbook to the health playbook. PR: https://github.com/openshift/openshift-ansible/pull/9700
Commit pushed to master at https://github.com/openshift/openshift-ansible https://github.com/openshift/openshift-ansible/commit/1ff1a0bb135f5ebd43c73ff841773cac12e7e6a0 Get cluster resources for SDN check in health.yml Get cluster resources for the SDN check in health.yml, same as in adhoc.yml. This commit fixes bug 1619563. https://bugzilla.redhat.com/show_bug.cgi?id=1619563 * playbooks/openshift-checks/private/health.yml: Add task to get cluster resources for the SDN check.
Verified with version openshift-ansible-3.11.0-0.28.0.git.0.730d4be.el7.noarch, python error doesn't appear.
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, 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-2018:2652