ipa_sudorule: Fix bug: get_sudorule_diff() takes exactly 2 arguments (3 given) (#21150)

This commit is contained in:
Thomas Krahn 2017-07-21 23:39:43 +02:00 committed by René Moser
parent 4fb5221b5f
commit 141c6d0d9d

View file

@ -247,21 +247,6 @@ def get_sudorule_dict(cmdcategory=None, description=None, hostcategory=None, ipa
return data
def get_sudorule_diff(ipa_sudorule, module_sudorule):
data = []
for key in module_sudorule.keys():
module_value = module_sudorule.get(key, None)
ipa_value = ipa_sudorule.get(key, None)
if isinstance(ipa_value, list) and not isinstance(module_value, list):
module_value = [module_value]
if isinstance(ipa_value, list) and isinstance(module_value, list):
ipa_value = sorted(ipa_value)
module_value = sorted(module_value)
if ipa_value != module_value:
data.append(key)
return data
def category_changed(module, client, category_name, ipa_sudorule):
if ipa_sudorule.get(category_name, None) == ['all']:
if not module.check_mode:
@ -304,7 +289,7 @@ def ensure(module, client):
if not module.check_mode:
ipa_sudorule = client.sudorule_add(name=name, item=module_sudorule)
else:
diff = get_sudorule_diff(client, ipa_sudorule, module_sudorule)
diff = client.get_diff(ipa_sudorule, module_sudorule)
if len(diff) > 0:
changed = True
if not module.check_mode: