Bug 1735551

Summary: Validations return exit code 0 on failed validations
Product: Red Hat OpenStack Reporter: Amit Ugol <augol>
Component: python-tripleoclientAssignee: Gaƫl Chamoulaud <gchamoul>
Status: CLOSED ERRATA QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: 15.0 (Stein)CC: beth.white, gchamoul, hbrock, jbuchta, jjoyce, jschluet, jslagle, mburns, slinaber, tvignaud
Target Milestone: betaKeywords: Triaged
Target Release: 16.0 (Train on RHEL 8.1)   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-tripleoclient-12.1.1-0.20190904113424.5075a76.el8ost Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-02-06 14:41:56 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 Amit Ugol 2019-08-01 05:13:23 UTC
Description of problem:
Even on failed validations, the return code of running validations is always 0. This happens if the validation failed as intended or if the validation's underline command has crashed.

Version-Release number of selected component (if applicable):
openstack-tripleo-validations-10.5.1-0.20190724100449.23ebc8a.el8ost.noarch

How reproducible:
100%

Steps to Reproduce:
1. run a validation that you have set to fail
2. echo $?
3.

Actual results:
0

Expected results:
1

Additional info:
example:

[FAILED] - neutron-sanity-check.yaml
    b'Using /tmp/neutron-sanity-check.yamllxj8hl04ansible.cfg as config file'
    b' [ERROR]: /usr/lib/python3.6/site-packages/urllib3/connection.py:374:'
    b'SubjectAltNameWarning: Certificate for 192.168.24.2 has no `subjectAltName`,'
    b'falling back to check for a `commonName` for now. This feature is being removed'
    b'by major browsers and deprecated by RFC 2818. (See'
    b'https://github.com/shazow/urllib3/issues/497 for details.)'
    b'SubjectAltNameWarning /usr/lib/python3.6/site-'
    b'packages/urllib3/connection.py:374: SubjectAltNameWarning: Certificate for'
    b'192.168.24.2 has no `subjectAltName`, falling back to check for a `commonName`'
    b'for now. This feature is being removed by major browsers and deprecated by RFC'
    b'2818. (See https://github.com/shazow/urllib3/issues/497 for details.)'
    b'SubjectAltNameWarning /usr/lib/python3.6/site-'
    b'packages/urllib3/connection.py:374: SubjectAltNameWarning: Certificate for'
    b'192.168.24.2 has no `subjectAltName`, falling back to check for a `commonName`'
    b'for now. This feature is being removed by major browsers and deprecated by RFC'
    b'2818. (See https://github.com/shazow/urllib3/issues/497 for details.)'
    b'SubjectAltNameWarning'
    b"Task 'neutron-sanity-check : Run neutron-sanity-check' failed:"
    b'Host: controller-0'
    b'Message: Command `podman exec -u root neutron_ovs_agent /bin/bash -c neutron-sanity-check --config-file /usr/share/neutron/neutron-dist.conf` exited with code: 1: non-
zero return code'
    b'stderr:'
    b'    2019-07-30 04:39:36.752 578821 INFO neutron.common.config [-] Logging enabled!\x1b[00m'
    b'    2019-07-30 04:39:36.752 578821 INFO neutron.common.config [-] /usr/bin/neutron-sanity-check version 14.0.3.dev22\x1b[00m'
    b"    2019-07-30 04:39:36.806 578821 INFO oslo.privsep.daemon [-] Running privsep helper: ['sudo', 'privsep-helper', '--config-file', '/usr/share/neutron/neutron-dist.co
nf', '--privsep_context', 'neutron.privileged.default', '--privsep_sock_path', '/tmp/tmph5h_9drr/privsep.sock']\x1b[00m"
    b'    2019-07-30 04:39:37.519 578821 INFO oslo.privsep.daemon [-] Spawned new privsep daemon via rootwrap\x1b[00m'
    b'    2019-07-30 04:39:37.435 578875 INFO oslo.privsep.daemon [-] privsep daemon starting\x1b[00m'
    b'    2019-07-30 04:39:37.438 578875 INFO oslo.privsep.daemon [-] privsep process running with uid/gid: 0/0\x1b[00m'
    b'    2019-07-30 04:39:37.442 578875 INFO oslo.privsep.daemon [-] privsep process running with capabilities (eff/prm/inh): CAP_DAC_OVERRIDE|CAP_DAC_READ_SEARCH|CAP_NET_A
DMIN|CAP_SYS_ADMIN/CAP_DAC_OVERRIDE|CAP_DAC_READ_SEARCH|CAP_NET_ADMIN|CAP_SYS_ADMIN/none\x1b[00m'
    b'    2019-07-30 04:39:37.442 578875 INFO oslo.privsep.daemon [-] privsep daemon running as pid 578875\x1b[00m'
    b'    2019-07-30 04:39:38.085 578821 CRITICAL neutron [-] Unhandled error: neutron.privileged.agent.linux.ip_lib.InterfaceAlreadyExists: Interface vxlantest-6746f alread
y exists.'
    b'    2019-07-30 04:39:38.085 578821 ERROR neutron Traceback (most recent call last):'
    b'    2019-07-30 04:39:38.085 578821 ERROR neutron   File "/usr/bin/neutron-sanity-check", line 10, in <module>'
    b'    2019-07-30 04:39:38.085 578821 ERROR neutron     sys.exit(main())'
    b'    2019-07-30 04:39:38.085 578821 ERROR neutron   File "/usr/lib/python3.6/site-packages/neutron/cmd/sanity_check.py", line 417, in main'
    b'    2019-07-30 04:39:38.085 578821 ERROR neutron     return 0 if all_tests_passed() else 1'
    b'    2019-07-30 04:39:38.085 578821 ERROR neutron   File "/usr/lib/python3.6/site-packages/neutron/cmd/sanity_check.py", line 404, in all_tests_passed'
    b'    2019-07-30 04:39:38.085 578821 ERROR neutron     return all(opt.callback() for opt in OPTS if cfg.CONF.get(opt.name))'
    b'    2019-07-30 04:39:38.085 578821 ERROR neutron   File "/usr/lib/python3.6/site-packages/neutron/cmd/sanity_check.py", line 404, in <genexpr>'
    b'    2019-07-30 04:39:38.085 578821 ERROR neutron     return all(opt.callback() for opt in OPTS if cfg.CONF.get(opt.name))'
    b'    2019-07-30 04:39:38.085 578821 ERROR neutron   File "/usr/lib/python3.6/site-packages/neutron/cmd/sanity_check.py", line 71, in check_iproute2_vxlan'
    b'    2019-07-30 04:39:38.085 578821 ERROR neutron     result = checks.iproute2_vxlan_supported()'
    b'    2019-07-30 04:39:38.085 578821 ERROR neutron   File "/usr/lib/python3.6/site-packages/neutron/cmd/sanity/checks.py", line 65, in iproute2_vxlan_supported'
    b'    2019-07-30 04:39:38.085 578821 ERROR neutron     port = ip.add_vxlan(name, 3000)'
    b'    2019-07-30 04:39:38.085 578821 ERROR neutron   File "/usr/lib/python3.6/site-packages/neutron/agent/linux/ip_lib.py", line 291, in add_vxlan'
    b'    2019-07-30 04:39:38.085 578821 ERROR neutron     privileged.create_interface(name, self.namespace, "vxlan", **kwargs)'
    b'    2019-07-30 04:39:38.085 578821 ERROR neutron   File "/usr/lib/python3.6/site-packages/oslo_privsep/priv_context.py", line 241, in _wrap'
    b'    2019-07-30 04:39:38.085 578821 ERROR neutron     return self.channel.remote_call(name, args, kwargs)'
    b'    2019-07-30 04:39:38.085 578821 ERROR neutron   File "/usr/lib/python3.6/site-packages/oslo_privsep/daemon.py", line 203, in remote_call'
    b'    2019-07-30 04:39:38.085 578821 ERROR neutron     raise exc_type(*result[2])'
    b'    2019-07-30 04:39:38.085 578821 ERROR neutron neutron.privileged.agent.linux.ip_lib.InterfaceAlreadyExists: Interface vxlantest-6746f already exists.'
    b'    2019-07-30 04:39:38.085 578821 ERROR neutron \x1b[00m'
    b'    exit status 1'
    b"Task 'neutron-sanity-check : Run neutron-sanity-check' failed:"
    b'Host: controller-0'
    b'Message: Command `podman exec -u root neutron_ovs_agent /bin/bash -c neutron-sanity-check --config-file /etc/neutron/fwaas_driver.ini` exited with code: 1: non-zero re
turn code'
    b'stderr:'
    b'    2019-07-30 04:39:48.447 580247 INFO neutron.common.config [-] Logging enabled!\x1b[00m'
    b'    2019-07-30 04:39:48.447 580247 INFO neutron.common.config [-] /usr/bin/neutron-sanity-check version 14.0.3.dev22\x1b[00m'
    b'    2019-07-30 04:39:48.452 580247 CRITICAL neutron [-] Unhandled error: oslo_config.cfg.ConfigFilesNotFoundError: Failed to find some config files: /etc/neutron/fwaas
_driver.ini'
    b'    2019-07-30 04:39:48.452 580247 ERROR neutron Traceback (most recent call last):'
    b'    2019-07-30 04:39:48.452 580247 ERROR neutron   File "/usr/bin/neutron-sanity-check", line 10, in <module>'
    b'    2019-07-30 04:39:48.452 580247 ERROR neutron     sys.exit(main())'
    b'    2019-07-30 04:39:48.452 580247 ERROR neutron   File "/usr/lib/python3.6/site-packages/neutron/cmd/sanity_check.py", line 412, in main'
    b'    2019-07-30 04:39:48.452 580247 ERROR neutron     config.init(sys.argv[1:], default_config_files=[])'
    b'    2019-07-30 04:39:48.452 580247 ERROR neutron   File "/usr/lib/python3.6/site-packages/neutron/common/config.py", line 80, in init'
    b'    2019-07-30 04:39:48.452 580247 ERROR neutron     **kwargs)'
    b'    2019-07-30 04:39:48.452 580247 ERROR neutron   File "/usr/lib/python3.6/site-packages/oslo_config/cfg.py", line 2124, in __call__'
    b'    2019-07-30 04:39:48.452 580247 ERROR neutron     raise ConfigFilesNotFoundError(self._namespace._files_not_found)'
    b'    2019-07-30 04:39:48.452 580247 ERROR neutron oslo_config.cfg.ConfigFilesNotFoundError: Failed to find some config files: /etc/neutron/fwaas_driver.ini'
    b'    2019-07-30 04:39:48.452 580247 ERROR neutron \x1b[00m'
    b'    exit status 1'
    b"Task 'neutron-sanity-check : Run neutron-sanity-check' failed:"
    b'Host: controller-1'
    b'Message: Command `podman exec -u root neutron_ovs_agent /bin/bash -c neutron-sanity-check --config-file /etc/neutron/fwaas_driver.ini` exited with code: 1: non-zero re

(This goes on for a while)

    b'2019-07-30 04:39:49.238 580403 ERROR neutron     raise ConfigFilesNotFoundError(self._namespace._files_not_found)'
    b'2019-07-30 04:39:49.238 580403 ERROR neutron oslo_config.cfg.ConfigFilesNotFoundError: Failed to find some config files: /etc/neutron/fwaas_driver.ini'
    b'2019-07-30 04:39:49.238 580403 ERROR neutron \x1b[00m'
    b'Failure! The validation failed for all hosts:'
    b'* controller-0'
    b'* controller-1'
    b'* controller-2'

(undercloud) [stack@undercloud-0 ~]$ echo $?
0

Comment 6 errata-xmlrpc 2020-02-06 14:41:56 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, 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/RHEA-2020:0283