Skip to content
Snippets Groups Projects
Unverified Commit 7ba057f1 authored by Rafael Guterres Jeffman's avatar Rafael Guterres Jeffman Committed by GitHub
Browse files

Merge pull request #547 from t-woerner/sudorule_fix_category_reset_idempotency

ipasudorule: Fix category reset for idempotency
parents fe7929cd 34bd2562
No related branches found
No related tags found
No related merge requests found
...@@ -416,6 +416,32 @@ def main(): ...@@ -416,6 +416,32 @@ def main():
if action == "sudorule": if action == "sudorule":
# Found the sudorule # Found the sudorule
if res_find is not None: if res_find is not None:
# Remove empty usercategory, hostcategory,
# cmdcaterory, runasusercategory and hostcategory
# from args if "" and if the category is not in the
# sudorule. The empty string is used to reset the
# category.
if "usercategory" in args \
and args["usercategory"] == "" \
and "usercategory" not in res_find:
del args["usercategory"]
if "hostcategory" in args \
and args["hostcategory"] == "" \
and "hostcategory" not in res_find:
del args["hostcategory"]
if "cmdcategory" in args \
and args["cmdcategory"] == "" \
and "cmdcategory" not in res_find:
del args["cmdcategory"]
if "ipasudorunasusercategory" in args \
and args["ipasudorunasusercategory"] == "" \
and "ipasudorunasusercategory" not in res_find:
del args["ipasudorunasusercategory"]
if "ipasudorunasgroupcategory" in args \
and args["ipasudorunasgroupcategory"] == "" \
and "ipasudorunasgroupcategory" not in res_find:
del args["ipasudorunasgroupcategory"]
# For all settings is args, check if there are # For all settings is args, check if there are
# different settings in the find result. # different settings in the find result.
# If yes: modify # If yes: modify
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment