mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
(cherry picked from commit c0f3a63e18
)
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
115eab2cfa
commit
76a64ea733
2 changed files with 17 additions and 3 deletions
2
changelogs/fragments/1871-infoblox-inventory.yml
Normal file
2
changelogs/fragments/1871-infoblox-inventory.yml
Normal 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)."
|
|
@ -13,10 +13,22 @@ import json
|
|||
import argparse
|
||||
|
||||
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_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
|
||||
try:
|
||||
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 = [
|
||||
|
|
Loading…
Reference in a new issue