Description of problem: Parameter fetch_nested in facts modules (e.g. ovirt_vm_facts) returns data only for <link> elements. But there are also <template>, <storage_domain> and other elements that could load data too. for example in VM API call: <lease> <storage_domain href="/ovirt-engine/api/storagedomains/b1d7018b-14b1-4766-b390-5a95974ec38b" id="b1d7018b-14b1-4766-b390-5a95974ec38b"/> </lease> ... <cluster href="/ovirt-engine/api/clusters/00000002-0002-0002-0002-00000000017a" id="00000002-0002-0002-0002-00000000017a"/> <cpu_profile href="/ovirt-engine/api/cpuprofiles/58a16ddd-0017-0195-0176-0000000000d9" id="58a16ddd-0017-0195-0176-0000000000d9"/> <quota id="58a16e35-03c4-03d0-0104-0000000001ce"/> <next_run_configuration_exists>false</next_run_configuration_exists> <numa_tune_mode>interleave</numa_tune_mode> <status>down</status> <stop_time>2018-10-31T09:18:53.411+01:00</stop_time> <original_template href="/ovirt-engine/api/templates/00000000-0000-0000-0000-000000000000" id="00000000-0000-0000-0000-000000000000"/> <template href="/ovirt-engine/api/templates/00000000-0000-0000-0000-000000000000" id="00000000-0000-0000-0000-000000000000"/>
Direct elements works, e.g. disks: <quota href="/ovirt-engine/api/datacenters/87bc2e30-f3b1-11e8-aa7d-001a4a013f36/quotas/96f2a2e4-f3b1-11e8-82b6-001a4a013f36" id="96f2a2e4-f3b1-11e8-82b6-001a4a013f36"/> --> "quota": { "href": "/ovirt-engine/api/datacenters/87bc2e30-f3b1-11e8-aa7d-001a4a013f36/quotas/96f2a2e4-f3b1-11e8-82b6-001a4a013f36", "id": "96f2a2e4-f3b1-11e8-82b6-001a4a013f36", "name": "Default" }, But when the element is in a list or other element, it doesn't work, e.g. in disks: <storage_domains> <storage_domain href="/ovirt-engine/api/storagedomains/82ceb4c9-e844-4fc7-b0ff-559052e6301f" id="82ceb4c9-e844-4fc7-b0ff-559052e6301f"/> </storage_domains> --> "storage_domains": [ { "href": "/ovirt-engine/api/storagedomains/82ceb4c9-e844-4fc7-b0ff-559052e6301f", "id": "82ceb4c9-e844-4fc7-b0ff-559052e6301f" } ], or template: <version> <version_name>base version</version_name> <version_number>1</version_number> <base_template href="/ovirt-engine/api/templates/264640fc-1b51-4263-995b-47e3e9dd3c8f" id="264640fc-1b51-4263-995b-47e3e9dd3c8f"/> </version> --> "version": { "base_template": { "href": "/ovirt-engine/api/templates/264640fc-1b51-4263-995b-47e3e9dd3c8f", "id": "264640fc-1b51-4263-995b-47e3e9dd3c8f" }, "version_name": "base version", "version_number": 1 }, Tested in ansible-2.8.0-0.9.rc3.el7ae.noarch
One other thing I've found, ovirt_host_facts returns more on <cluster> than needed when not nested. ovirt_host_facts: auth: "{{ ovirt_auth }}" pattern: "name=vhost*" fetch_nested: True nested_attributes: - name returns correctly: "cluster": { "href": "/ovirt-engine/api/clusters/87c0c65c-f3b1-11e8-9209-001a4a013f36", "id": "87c0c65c-f3b1-11e8-9209-001a4a013f36", "name": "Default" }, but with fetch_nested: False returns all information on the cluster "cluster": { "affinity_groups": [], "ballooning_enabled": false, "comment": "", "cpu": { "architecture": "x86_64", "type": "Intel Westmere Family" }, .... But in module ovirt_vm_facts it works as expected.
We fetch this info in ovirt_host_facts, so we are able to compare cluster version and filter it. This is different issue only in ovirt_host_facts. Can you please open an issue for that module.
Done - BZ 1719303
ansible-2.8.3 has been released, please check this bug is fixed there.
Can we get this verified?
Working for storage_domains in disks, but for base_template in element version in template still doesn't return name of template ansible localhost -m ovirt_template_facts -a 'pattern="name=*" fetch_nested=True nested_attributes=name' ...... "version": { "base_template": { "href": "/ovirt-engine/api/templates/154f10b7-de72-4b0b-87cf-54a52d7ad035", "id": "154f10b7-de72-4b0b-87cf-54a52d7ad035" }, ...... VS <template href="/ovirt-engine/api/templates/154f10b7-de72-4b0b-87cf-54a52d7ad035" id="154f10b7-de72-4b0b-87cf-54a52d7ad035"> ..... <name>golden_template_rhel7.7</name> # ansible --version ansible 2.8.4
(In reply to Pavol Brilla from comment #10) > Working for storage_domains in disks, but for base_template in element > version in template still doesn't return name of template > > ansible localhost -m ovirt_template_facts -a 'pattern="name=*" > fetch_nested=True nested_attributes=name' > ...... > "version": { > "base_template": { > "href": > "/ovirt-engine/api/templates/154f10b7-de72-4b0b-87cf-54a52d7ad035", > "id": "154f10b7-de72-4b0b-87cf-54a52d7ad035" > }, > ...... > > VS > > <template > href="/ovirt-engine/api/templates/154f10b7-de72-4b0b-87cf-54a52d7ad035" > id="154f10b7-de72-4b0b-87cf-54a52d7ad035"> > ..... > <name>golden_template_rhel7.7</name> > > > > # ansible --version > ansible 2.8.4 Going over each nested attribute attributes and checking if it's a link would bring much bigger time complexity, for no value IMHO. We should document that by default we go only over first level attributes, not any other level of attribute and maybe add parameter which enables going deeper, but I would close this bug, and open new one to track this. Moving back to ON_QA.
Issue opened for clarification: https://github.com/ansible/ansible/issues/63127 As previously stated other cases verified
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/RHSA-2019:2543