diff options
author | Adrian Likins <alikins@redhat.com> | 2017-08-01 12:51:33 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-01 12:51:33 -0400 |
commit | 17ab546c48448602023179565546079e677b4f23 (patch) | |
tree | 95cc6543834e059d00df84368c7ab8876f4cecb3 /test/integration/targets/gathering_facts | |
parent | 3db768f39362bb80c8fa10794a0c69bc88aedba5 (diff) | |
download | ansible-17ab546c48448602023179565546079e677b4f23.tar.gz |
Add 2.0-2.3 facts api compat (ansible_facts(), get_all_facts()) (#27294)
* Add 2.0-2.3 facts api compat (ansible_facts(), get_all_facts())
These are intended to provide compatibilty for modules that
use 'ansible.module_utils.facts.ansible_facts' and
'ansible.module_utils.facts.get_all_facts' from 2.0-2.3 facts
API.
Fixes #25686
Some related changes/fixes needed to provide the compat api:
* rm ansible.constants import from module_utils.facts.compat
Just use a hard coded default for gather_subset/gather_timeout
instead of trying to load it from non existent config if the
module params dont include it.
* include 'external' collectors in compat ansible_facts()
* Add facter/ohai back to the valid collector classes
facter/ohai had gotten removed from the default_collectors
class used as the default list for all_collector_classes by
setup.py and compat.py
That made gather_subset['facter'] fail.
Diffstat (limited to 'test/integration/targets/gathering_facts')
-rw-r--r-- | test/integration/targets/gathering_facts/test_gathering_facts.yml | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/integration/targets/gathering_facts/test_gathering_facts.yml b/test/integration/targets/gathering_facts/test_gathering_facts.yml index fab438a4ec..6b3ed31d9e 100644 --- a/test/integration/targets/gathering_facts/test_gathering_facts.yml +++ b/test/integration/targets/gathering_facts/test_gathering_facts.yml @@ -32,6 +32,7 @@ - 'ansible_mounts|default("UNDEF_NET") != "UNDEF_HW"' - 'ansible_virtualization_role|default("UNDEF_VIRT") != "UNDEF_VIRT"' + - hosts: facthost19 tags: [ 'fact_min' ] connection: local @@ -260,3 +261,18 @@ assert: that: - '"{{ ansible_local.testfact.fact_dir }}" == "custom"' + +- hosts: facthost20 + tags: [ 'fact_facter_ohai' ] + connection: local + gather_subset: + - facter + - ohai + gather_facts: yes + tasks: + - name: Test that retrieving facter and ohai doesnt fail + assert: + # not much to assert here, aside from not crashing, since test images dont have + # facter/ohai + that: + - 'ansible_user_id|default("UNDEF_MIN") != "UNDEF_MIN"' |