Merge pull request #780 from rjeffman/module_utils_empty_strings_and_inexistent_attributes

module_utils: Fix comparison of elements not in IPA object.
This commit is contained in:
Thomas Woerner
2022-04-27 08:29:38 +02:00
committed by GitHub
5 changed files with 170 additions and 67 deletions

View File

@@ -126,7 +126,8 @@ class AutomountMap(IPAAnsibleModule):
_args = {}
if mapname:
_args["automountmapname"] = mapname
if desc:
# An empty string is valid and will clear the attribute.
if desc is not None:
_args["description"] = desc
return _args

View File

@@ -1103,20 +1103,6 @@ def main():
if "noprivate" in args:
del args["noprivate"]
# Ignore sshpubkey if it is empty (for resetting)
# and not set in for the user
if "ipasshpubkey" not in res_find and \
"ipasshpubkey" in args and \
args["ipasshpubkey"] == ['']:
del args["ipasshpubkey"]
# Ignore userauthtype if it is empty (for resetting)
# and not set in for the user
if "ipauserauthtype" not in res_find and \
"ipauserauthtype" in args and \
args["ipauserauthtype"] == ['']:
del args["ipauserauthtype"]
# For all settings is args, check if there are
# different settings in the find result.
# If yes: modify