mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 03:11:24 -07:00
* Fix crash in case of tombstoning.
* Extend tests.
(cherry picked from commit c23bbb5c4a
)
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
a26792418e
commit
01b2c48161
3 changed files with 30 additions and 8 deletions
|
@ -7,6 +7,11 @@ __metaclass__ = type
|
|||
|
||||
from ansible.plugins.loader import action_loader, module_loader
|
||||
|
||||
try:
|
||||
from ansible.errors import AnsiblePluginRemovedError
|
||||
except ImportError:
|
||||
AnsiblePluginRemovedError = Exception
|
||||
|
||||
|
||||
def a_module(term):
|
||||
"""
|
||||
|
@ -14,14 +19,17 @@ def a_module(term):
|
|||
- 'community.general.ufw' is community.general.a_module
|
||||
- 'community.general.does_not_exist' is not community.general.a_module
|
||||
"""
|
||||
for loader in (action_loader, module_loader):
|
||||
data = loader.find_plugin(term)
|
||||
# Ansible 2.9 returns a tuple
|
||||
if isinstance(data, tuple):
|
||||
data = data[0]
|
||||
if data is not None:
|
||||
return True
|
||||
return False
|
||||
try:
|
||||
for loader in (action_loader, module_loader):
|
||||
data = loader.find_plugin(term)
|
||||
# Ansible 2.9 returns a tuple
|
||||
if isinstance(data, tuple):
|
||||
data = data[0]
|
||||
if data is not None:
|
||||
return True
|
||||
return False
|
||||
except AnsiblePluginRemovedError:
|
||||
return False
|
||||
|
||||
|
||||
class TestModule(object):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue