mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-05-07 13:53:23 +00:00
ansible_freeipa_module: Fix comparison of bool parameters in compare_args_ipa
Bool types are not iterable. Therefore the comparison using sets was failing with a TypeError. This prevented to change the bool parameters for hosts. A test for the host module has been added to verify that the bool parameters can be modified. New test: tests/host/test_host_bool_params.yml Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1784514
This commit is contained in:
@@ -222,10 +222,20 @@ def compare_args_ipa(module, args, ipa):
|
||||
arg = [to_text(_arg) for _arg in arg]
|
||||
if isinstance(ipa_arg[0], unicode) and isinstance(arg[0], int):
|
||||
arg = [to_text(_arg) for _arg in arg]
|
||||
# module.warn("%s <=> %s" % (arg, ipa_arg))
|
||||
if set(arg) != set(ipa_arg):
|
||||
# module.warn("DIFFERENT")
|
||||
return False
|
||||
# module.warn("%s <=> %s" % (repr(arg), repr(ipa_arg)))
|
||||
try:
|
||||
arg_set = set(arg)
|
||||
ipa_arg_set = set(ipa_arg)
|
||||
except TypeError:
|
||||
if arg != ipa_arg:
|
||||
# module.warn("%s != %s" % (repr(arg), repr(ipa_arg)))
|
||||
return False
|
||||
else:
|
||||
if arg_set != ipa_arg_set:
|
||||
# module.warn("%s != %s" % (repr(arg), repr(ipa_arg)))
|
||||
return False
|
||||
|
||||
# module.warn("%s == %s" % (repr(arg), repr(ipa_arg)))
|
||||
|
||||
return True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user