mirror of
https://github.com/altlinux/gpupdate.git
synced 2025-03-20 18:50:17 +03:00
util.users.with_privileges(): return function result
This commit is contained in:
parent
ad3624d73e
commit
2bd533acb8
@ -99,11 +99,14 @@ def with_privileges(username, func):
|
||||
|
||||
# We need to catch exception in order to be able to restore
|
||||
# privileges later in this function
|
||||
out = None
|
||||
try:
|
||||
func()
|
||||
out = func()
|
||||
except Exception as exc:
|
||||
logging.debug(slogm(exc))
|
||||
|
||||
# Restore privileges
|
||||
set_privileges('root', current_uid, 0, current_groups)
|
||||
|
||||
return out
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user