mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-26 14:41: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
|
@ -589,7 +589,7 @@ DEFAULT_GATHERING:
|
||||||
choices: ['smart', 'explicit', 'implicit']
|
choices: ['smart', 'explicit', 'implicit']
|
||||||
DEFAULT_GATHER_SUBSET:
|
DEFAULT_GATHER_SUBSET:
|
||||||
name: Gather facts subset
|
name: Gather facts subset
|
||||||
default: 'all'
|
default: ['all']
|
||||||
description:
|
description:
|
||||||
- Set the `gather_subset` option for the M(setup) task in the implicit fact gathering.
|
- Set the `gather_subset` option for the M(setup) task in the implicit fact gathering.
|
||||||
See the module documentation for specifics.
|
See the module documentation for specifics.
|
||||||
|
|
|
@ -59,7 +59,7 @@ class Play(Base, Taggable, Become):
|
||||||
# Facts
|
# Facts
|
||||||
_fact_path = FieldAttribute(isa='string', default=None)
|
_fact_path = FieldAttribute(isa='string', default=None)
|
||||||
_gather_facts = FieldAttribute(isa='bool', default=None, always_post_validate=True)
|
_gather_facts = FieldAttribute(isa='bool', default=None, always_post_validate=True)
|
||||||
_gather_subset = FieldAttribute(isa='list', default=None, always_post_validate=True)
|
_gather_subset = FieldAttribute(isa='list', default=None, listof=string_types, always_post_validate=True)
|
||||||
_gather_timeout = FieldAttribute(isa='int', default=None, always_post_validate=True)
|
_gather_timeout = FieldAttribute(isa='int', default=None, always_post_validate=True)
|
||||||
|
|
||||||
# Variable Attributes
|
# Variable Attributes
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
- hosts: facthost1
|
- hosts: facthost1
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
tasks:
|
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
|
- name: install test local facts
|
||||||
copy:
|
copy:
|
||||||
src: uuid.fact
|
src: uuid.fact
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue