Fix comparison logic in ovirt_initial_validations Ansible role
o0-o opened this issue · 1 comments
Affected version
- oVirt Engine: ovirt-engine-4.5.4-1.el8.noarch
- Host OS Variant: oVirt Node 4.5.4
- VDSM version: vdsm-4.50.3.4-1.el8.x86_64
- Ansible Core version: 2.15.0
- Python version: 3.11.2
Describe the bug
If elasticsearch_host
or fluentd_elasticsearch_host
are undefined, hosted-engine --deploy
will fail (timeout waiting for the engine to add the host).
The tasks file is located here on the engine vm:
/usr/share/ansible/roles/oVirt.metrics/roles/ovirt_initial_validations/tasks/check_logging_collectors.yml
The following lines will fail if elasticsearch_host
or fluentd_elasticsearch_host
are undefined:
elasticsearch_host == None or elasticsearch_host is undefined
fluentd_elasticsearch_host == None or fluentd_elasticsearch_host is undefined
when: (fluentd_elasticsearch_host == "elasticsearch-server.example.com") or (fluentd_elasticsearch_host is undefined)
(Comparing undefined
to anything will fail, even if is undefined
appears later in the logic)
Possible solution:
elasticsearch_host | default(None) == None
fluentd_elasticsearch_host | default(None) == None
when: (fluentd_elasticsearch_host | default == "elasticsearch-server.example.com")
In the last case, I'm not sure what it's purpose is since it's a hard-coded example... is the role generated dynamically?
To reproduce
-
hosted-engine --deploy --4
-
Install
pip3.11
and thennetaddr
on the engine VM immediately after the Python 3.11 is installed (per #867)
Expected behavior
The engine should not fail while adding its host.
Additional context
For anyone looking for a quick fix:
- Console into the engine vm from the host node:
virsh -c qemu:///system?authfile=/etc/ovirt-hosted-engine/virsh_auth.conf console HostedEngineLocal
- Set the
elasticsearch_host
andfluentd_elasticsearch_host
toNone
in defaults:
printf '%s\n' 'elasticsearch_host:' 'fluentd_elasticsearch_host:' >> /usr/share/ansible/roles/oVirt.metrics/roles/ovirt_initial_validations/defaults/main.yml
This was fixed by oVirt/ovirt-engine-metrics#35