1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Improve infoblox inventory script dependencies. (#1871)

This commit is contained in:
Felix Fontein 2021-02-21 21:11:54 +01:00 committed by GitHub
parent 389b004879
commit c0f3a63e18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 3 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- "infoblox inventory script - make sure that the script also works with Ansible 2.9, and returns a more helpful error when community.general is not installed as part of Ansible 2.10/3 (https://github.com/ansible-collections/community.general/pull/1871)."

View file

@ -13,10 +13,22 @@ import json
import argparse import argparse
from ansible.parsing.dataloader import DataLoader from ansible.parsing.dataloader import DataLoader
from ansible.module_utils.six import iteritems from ansible.module_utils.six import iteritems, raise_from
from ansible.module_utils._text import to_text from ansible.module_utils._text import to_text
from ansible_collections.community.general.plugins.module_utils.net_tools.nios.api import WapiInventory try:
from ansible_collections.community.general.plugins.module_utils.net_tools.nios.api import normalize_extattrs, flatten_extattrs from ansible_collections.community.general.plugins.module_utils.net_tools.nios.api import WapiInventory
from ansible_collections.community.general.plugins.module_utils.net_tools.nios.api import normalize_extattrs, flatten_extattrs
except ImportError as exc:
try:
# Fallback for Ansible 2.9
from ansible.module_utils.net_tools.nios.api import WapiInventory
from ansible.module_utils.net_tools.nios.api import normalize_extattrs, flatten_extattrs
except ImportError:
raise_from(
Exception(
'This inventory plugin only works with Ansible 2.9, 2.10, or 3, or when community.general is installed correctly in PYTHONPATH.'
' Try using the inventory plugin from infoblox.nios_modules instead.'),
exc)
CONFIG_FILES = [ CONFIG_FILES = [