ansible/test/integration/targets/inventory_plugin_config/runme.sh
Pilou 06f5e49dfb inventory plugins: add test about config API usage (#41888)
* Check get_option method works with inventory plugins

This use case is already tested by some cloud inventoty plugin but
these tests are slow and aren't always executed, hence this new quick
test.

* AnsiblePlugin: Fix typo in docstring
2018-07-19 10:45:45 -07:00

16 lines
705 B
Bash
Executable file

#!/usr/bin/env bash
set -o errexit -o nounset -o xtrace
export ANSIBLE_INVENTORY_PLUGINS=./
export ANSIBLE_INVENTORY_ENABLED=test_inventory
# check default values
ansible-inventory --list -i ./config_without_parameter.yml --export | \
env python -c "import json, sys; inv = json.loads(sys.stdin.read()); \
assert set(inv['_meta']['hostvars']['test_host']['departments']) == set(['seine-et-marne', 'haute-garonne'])"
# check values
ansible-inventory --list -i ./config_with_parameter.yml --export | \
env python -c "import json, sys; inv = json.loads(sys.stdin.read()); \
assert set(inv['_meta']['hostvars']['test_host']['departments']) == set(['paris'])"