|
|
|
@ -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:
|
|
|
|
|