Bug 1748025

Summary: ovirt_host_facts module returns wrong hrefs in nested values
Product: Red Hat Enterprise Virtualization Manager Reporter: Jan Zmeskal <jzmeskal>
Component: ansibleAssignee: Ondra Machacek <omachace>
Status: CLOSED NEXTRELEASE QA Contact: Pavol Brilla <pbrilla>
Severity: low Docs Contact:
Priority: low    
Version: 4.3.5CC: lsvaty, mperina, pelauter
Target Milestone: ovirt-4.3.8Keywords: ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ansible-2.9.1 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-09 12:46:47 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jan Zmeskal 2019-09-02 13:49:41 UTC
Description of problem:
When you execute ovirt_host_facts module against an engine, some of the returned nested values (specifically hrefs) are wrong.

Version-Release number of selected component (if applicable):
rhvm-4.3.5.5-0.1.el7.noarch
ansible-2.8.4-1.el7ae.noarch
python-ovirt-engine-sdk4-4.3.2-1.el7ev.x86_64

How reproducible:
100 %

Steps to Reproduce:
1. Have a playbook that extracts facts about one of your hosts. Example here:

- name: Test ovirt module
  hosts: localhost
  tasks:
    
    - ovirt_auth:
        url: https://<engine_url>/ovirt-engine/api
        username: admin@internal
        password: <password>
        insecure: yes

    - ovirt_host_facts:
        auth: "{{ ovirt_auth }}"
        fetch_nested: yes
        pattern: "name=host_mixed_1"
        all_content: no

    - debug:
        var: ovirt_hosts

2. Run the playbook
3. Examine the returned value

Actual results:
1. First problem is in 'permissions' key of 'ovirt_hosts' fact. This is what is returned by Ansible: https://pastebin.com/YWdjs99d
This is what can be seen in API: https://pastebin.com/CmFNxFFs
As you can see, one of the permissions returned 'null' in 'href' key. However, when inspecting the RHV API, the same permission has valid href that can be followed when put into address line in browser. By following it, I found out that it is 'SuperUser' role of user 'admin'. I also did the same experiment at another RHV engine (of version 4.3.6) and observed the same.

2. There's a different 'href' for network attachment in returned ansible value and in API.
This is returned by ansible: https://pastebin.com/JVN6iSFv
This can be seen in API: https://pastebin.com/SEeuRNeh

Expected results:
Values returned by running ovirt_host_facts and those acquired by querying API should be consistent.

Comment 1 Pavol Brilla 2019-10-04 09:10:32 UTC
Very similar issue is raised by ovirt_cluster_facts module:

Permissions returned 'null' in 'href' key. However, when inspecting the RHV API, it is 'SuperUser' role of user 'admin' - that why I think it is same as one above for ovirt_hosts_facts

Comment 2 Pavol Brilla 2019-12-18 10:59:57 UTC
Persmission has only correct ids, href links were removed from modules.


Installed Packages
rhvm.noarch                                      4.3.8.1-0.1.master.el7                                      @rhv-4.3.8
[root@10-37-138-97 ~]# ansible --version
ansible 2.9.2