mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 13:20:23 -07:00
gather facts improvements (#44008)
* gather_subset is a list of strings When gather_subset is an integer, a message pointing out the problem, current tb error is replaced by this one: ERROR! the field 'gather_subset' should be a list of (<class 'str'>,), but the item '42' is a <class 'int'> ... * gathering_facts test: ensure smart gathering is on
This commit is contained in:
parent
23e44319ce
commit
2603604fd6
3 changed files with 14 additions and 10 deletions
|
@ -2,6 +2,10 @@
|
|||
- hosts: facthost1
|
||||
gather_facts: no
|
||||
tasks:
|
||||
- name: check that smart gathering is enabled
|
||||
fail:
|
||||
msg: 'smart gathering must be enabled'
|
||||
when: 'lookup("env", "ANSIBLE_GATHERING") != "smart"'
|
||||
- name: install test local facts
|
||||
copy:
|
||||
src: uuid.fact
|
||||
|
@ -13,14 +17,14 @@
|
|||
run_once: yes
|
||||
tasks:
|
||||
- block:
|
||||
- name: 'Check the same host is used'
|
||||
assert:
|
||||
that: 'hostvars.facthost1.ansible_fqdn == hostvars.facthost2.ansible_fqdn'
|
||||
msg: 'This test requires 2 inventory hosts referring to the same host.'
|
||||
- name: "Check that run_once doesn't prevent fact gathering (#39453)"
|
||||
assert:
|
||||
that: 'hostvars.facthost1.ansible_local.uuid != hostvars.facthost2.ansible_local.uuid'
|
||||
msg: "{{ 'Same value for ansible_local.uuid on both hosts: ' ~ hostvars.facthost1.ansible_local.uuid }}"
|
||||
- name: 'Check the same host is used'
|
||||
assert:
|
||||
that: 'hostvars.facthost1.ansible_fqdn == hostvars.facthost2.ansible_fqdn'
|
||||
msg: 'This test requires 2 inventory hosts referring to the same host.'
|
||||
- name: "Check that run_once doesn't prevent fact gathering (#39453)"
|
||||
assert:
|
||||
that: 'hostvars.facthost1.ansible_local.uuid != hostvars.facthost2.ansible_local.uuid'
|
||||
msg: "{{ 'Same value for ansible_local.uuid on both hosts: ' ~ hostvars.facthost1.ansible_local.uuid }}"
|
||||
always:
|
||||
- name: remove test local facts
|
||||
file:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue