1
0
mirror of https://github.com/altlinux/gpupdate.git synced 2025-08-25 09:49:53 +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

View File

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