actions: Allow privileged methods to be decorated again

- So that we write decorators that can handle errors as needed by backups app.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa authored and James Valleroy committed 2024-12-30 08:33:53 -05:00
1 parent 3a0db947b2
commit 9b29ea960f
1 file changed
+8 -1
+8 -1
View File
@@ -383,7 +383,14 @@ def _privileged_call(module_name, action_name, arguments):
if not getattr(action, '_privileged', None):
raise SyntaxError('Specified action is not privileged action')
func = getattr(action, '__wrapped__')
# Get the original function that may have been wrapped/decorated multiple
# times
func = action
while True:
try:
func = getattr(func, '__wrapped__')
except AttributeError:
break
_privileged_assert_valid_arguments(func, arguments)