Skip to content
Snippets Groups Projects
Commit fe364cc2 authored by Thomas Woerner's avatar Thomas Woerner
Browse files

ipadnsrecord: Fix for ansible-test fake execution test

All imports that are only available after installing IPA need to be in a
try exception clause to be able to pass the fake execution test.

If the imports can not be done, all used and needed attributes are
defined with the value None, MODULE_IMPORT_ERROR is set to the import
error and fail_json is called.
parent 71f3f110
No related branches found
No related tags found
No related merge requests found
......@@ -866,8 +866,13 @@ RETURN = """
from ansible.module_utils._text import to_text
from ansible.module_utils.ansible_freeipa_module import \
IPAAnsibleModule, is_ipv4_addr, is_ipv6_addr, ipalib_errors
try:
import dns.reversename
import dns.resolver
except ImportError as _err:
MODULE_IMPORT_ERROR = str(_err)
else:
MODULE_IMPORT_ERROR = None
from ansible.module_utils import six
......@@ -1131,6 +1136,9 @@ def configure_module():
ansible_module._ansible_debug = True
if MODULE_IMPORT_ERROR is not None:
ansible_module.fail_json(msg=MODULE_IMPORT_ERROR)
return ansible_module
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment