1
0
mirror of https://github.com/altlinux/gpupdate.git synced 2025-03-22 02:50:32 +03:00

gpupdate: Use new messaging mechanism

This will allow user to see coded messages like:

```
[E00001]: Insufficient permissions to run gpupdate
[E00002]: gpupdate will not be started
```

Now you may easily refer to the specific error code/message when asking
for technical support.
This commit is contained in:
Игорь Чудов 2020-05-22 03:41:42 +04:00
parent 7941157235
commit b6fb9abfa1
Signed by untrusted user: nir
GPG Key ID: 0F3883600CAE7AAC

View File

@ -39,6 +39,8 @@ from util.dbus import (
)
from util.signals import signal_handler
from messages import message_with_code
logging.basicConfig(level=logging.DEBUG)
class file_runner:
@ -128,7 +130,7 @@ def runner_factory(args, target):
user_runner = file_runner(username)
return (computer_runner, user_runner)
else:
logging.error('Insufficient permissions to run gpupdate')
logging.error(message_with_code('E1'))
return None
@ -151,7 +153,7 @@ def main():
logging.error('Error running GPOA for user: {}'.format(exc))
return int(ExitCodeUpdater.FAIL_GPUPDATE_USER_NOREPLY)
else:
logging.error('gpupdate will not be started')
logging.error(message_with_code('E2'))
return int(ExitCodeUpdater.FAIL_NO_RUNNER)
return int(ExitCodeUpdater.EXIT_SUCCESS)