mirror of
https://github.com/altlinux/gpupdate.git
synced 2025-03-21 18:50:38 +03:00
gpoa: Logging improved
This commit is contained in:
parent
23de5b63f6
commit
0851f96c6f
24
gpoa/gpoa
24
gpoa/gpoa
@ -40,6 +40,7 @@ from util.arguments import (
|
||||
set_loglevel
|
||||
)
|
||||
from util.logging import slogm
|
||||
from util.exceptions import geterr
|
||||
from util.signals import signal_handler
|
||||
|
||||
def parse_arguments():
|
||||
@ -113,12 +114,28 @@ class gpoa_controller:
|
||||
|
||||
if not self.__args.noupdate:
|
||||
if is_root():
|
||||
back = backend_factory(dc, self.username, self.is_machine, nodomain)
|
||||
back = None
|
||||
try:
|
||||
back = backend_factory(dc, self.username, self.is_machine, nodomain)
|
||||
except Exception as exc:
|
||||
logdata = dict({'msg': str(exc)})
|
||||
einfo = geterr()
|
||||
print(einfo)
|
||||
print(type(einfo))
|
||||
#logdata.update(einfo)
|
||||
logging.error(slogm(message_with_code('E12'), logdata))
|
||||
if back:
|
||||
try:
|
||||
back.retrieve_and_store()
|
||||
except Exception as exc:
|
||||
logdata = dict({'message': str(exc)})
|
||||
# In case we're handling "E3" - it means that
|
||||
# this is a very specific exception that was
|
||||
# not handled properly on lower levels of
|
||||
# code so we're also printing file name and
|
||||
# other information.
|
||||
einfo = geterr()
|
||||
logdata.update(einfo)
|
||||
logging.error(slogm(message_with_code('E3'), logdata))
|
||||
|
||||
def start_frontend(self):
|
||||
@ -130,7 +147,10 @@ class gpoa_controller:
|
||||
appl.apply_parameters()
|
||||
except Exception as exc:
|
||||
logdata = dict({'message': str(exc)})
|
||||
logging.error(slogm(message_with_code('E4')))
|
||||
einfo = geterr()
|
||||
#print(einfo)
|
||||
logdata.update(einfo)
|
||||
logging.error(slogm(message_with_code('E4'), logdata))
|
||||
|
||||
def start_plugins(self):
|
||||
'''
|
||||
|
Loading…
x
Reference in New Issue
Block a user