diff --git a/changelogs/fragments/241-fix-ipa-modules-when-ipa_host-empty.yml b/changelogs/fragments/241-fix-ipa-modules-when-ipa_host-empty.yml new file mode 100644 index 0000000000..94e8f975fb --- /dev/null +++ b/changelogs/fragments/241-fix-ipa-modules-when-ipa_host-empty.yml @@ -0,0 +1,2 @@ +bugfixes: + - ipa modules - fix error when IPA_HOST is empty and fallback on DNS (https://github.com/ansible-collections/community.general/pull/241) diff --git a/plugins/module_utils/ipa.py b/plugins/module_utils/ipa.py index e6f959eda1..73e26a190c 100644 --- a/plugins/module_utils/ipa.py +++ b/plugins/module_utils/ipa.py @@ -43,7 +43,9 @@ from ansible.module_utils.basic import env_fallback, AnsibleFallbackNotFound def _env_then_dns_fallback(*args, **kwargs): ''' Load value from environment or DNS in that order''' try: - return env_fallback(*args, **kwargs) + result = env_fallback(*args, **kwargs) + if result == '': + raise AnsibleFallbackNotFound except AnsibleFallbackNotFound: # If no host was given, we try to guess it from IPA. # The ipa-ca entry is a standard entry that IPA will have set for