Bug 1806298

Summary: hc_wizard.yml: Hostname check fails with "'>' not supported between instances of 'list' and 'int'"
Product: [oVirt] cockpit-ovirt Reporter: Reto Gantenbein <reto.gantenbein>
Component: GenericAssignee: Gal Zaidman <gzaidman>
Status: CLOSED DUPLICATE QA Contact: SATHEESARAN <sasundar>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 0.14.1CC: bugs, cshao, eslutsky
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-02-24 07:41:03 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Gluster RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Reto Gantenbein 2020-02-23 16:48:06 UTC
The "Run Gluster Wizard for Single Node" deployment started via Cockpit fails on the second task when validating the hostname:

TASK [Check if valid hostnames are provided] ***********************************
task path: /usr/share/cockpit/ovirt-dashboard/ansible/hc_wizard.yml:16
changed: [node1.example.com -> localhost] => (item=node1.example.com) => {"ansible_loop_var": "item", "changed": true, "cmd": ["getent", "ahosts", "node1.example.com"], "delta": "0:00:00.006430", "end": "2020-02-18 14:43:34.896793", "item": "node1.example.com", "rc": 0, "start": "2020-02-18 14:43:34.890363", "stderr": "", "stderr_lines": [], "stdout": "10.0.0.6        STREAM node1.example.com\n10.0.0.6        DGRAM  \n10.0.0.6        RAW    ", "stdout_lines": ["10.0.0.6        STREAM node1.example.com", "10.0.0.6        DGRAM  ", "10.0.0.6        RAW    "]}

TASK [Check if provided hostnames are valid] ***********************************
task path: /usr/share/cockpit/ovirt-dashboard/ansible/hc_wizard.yml:29
fatal: [node1.example.com]: FAILED! => {"msg": "The conditional check 'result.results[0]['stdout_lines'] > 0' failed. The error was: Unexpected templating type error occurred on ({% if result.results[0]['stdout_lines'] > 0 %} True {% else %} False {% endif %}): '>' not supported between instances of 'list' and 'int'"}

I'm not sure how this could ever work as there is a Ansible variable type mismatch.

This was experienced on a CentOS 8 including:
ansible-2.9.4-1.el8.noarch
cockpit-ovirt-dashboard-0.14.1-1.el8.noarch

The fix is trivial. Compare with the length of the output which is empty if the host lookup is unsuccessful:

--- /usr/share/cockpit/ovirt-dashboard/ansible/hc_wizard.yml.orig       2020-02-18 14:48:33.678471259 +0100
+++ /usr/share/cockpit/ovirt-dashboard/ansible/hc_wizard.yml    2020-02-18 14:48:55.810456470 +0100
@@ -30,7 +30,7 @@
       assert:
         that:
           - "result.results[0]['rc'] == 0"
-          - "result.results[0]['stdout_lines'] > 0"
+          - "result.results[0]['stdout_lines'] | length > 0"
         fail_msg: "The given hostname is not valid FQDN"
       when: gluster_features_fqdn_check | default(true)

Comment 1 Gal Zaidman 2020-02-24 07:41:03 UTC
Marking this as duplicate of:
https://bugzilla.redhat.com/show_bug.cgi?id=1789277
it has been fixed on:
https://gerrit.ovirt.org/#/c/106890/

*** This bug has been marked as a duplicate of bug 1789277 ***