From 384abbea039bc393c42743c4245c3aaaaebb371a Mon Sep 17 00:00:00 2001 From: Fulvio Carrus Date: Fri, 18 Mar 2022 15:14:52 +0100 Subject: [PATCH] * Cast runasuser property from tuple to list The get method for ipasudorunas_user and ipasudorunasextuser returns a tuple instead of a list. Casting to list. * Consider externaluser members into user list The externaluser property was not taken into consideration while building the list of users to add to the sudorule. --- plugins/modules/ipasudorule.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/plugins/modules/ipasudorule.py b/plugins/modules/ipasudorule.py index 7d6cd860c6..0b077b3560 100644 --- a/plugins/modules/ipasudorule.py +++ b/plugins/modules/ipasudorule.py @@ -487,8 +487,8 @@ def main(): runasuser_add, runasuser_del = gen_add_del_lists( runasuser, ( - res_find.get('ipasudorunas_user', []) - + res_find.get('ipasudorunasextuser', []) + list(res_find.get('ipasudorunas_user', [])) + + list(res_find.get('ipasudorunasextuser', [])) ) ) @@ -522,7 +522,12 @@ def main(): hostgroup, res_find.get("memberhost_hostgroup")) if user is not None: user_add = gen_add_list( - user, res_find.get("memberuser_user")) + user, + ( + res_find.get("memberuser_user", []) + + list(res_find.get("externaluser", [])) + ) + ) if group is not None: group_add = gen_add_list( group, res_find.get("memberuser_group"))