Merge pull request 'fixes-win' (#13) from fixes-win into main
Reviewed-on: #13lgromero-filebeat 1.4.4
commit
b7b2a58186
|
@ -1,3 +1,10 @@
|
|||
ogagent (1.4.4-1) stable; urgency=medium
|
||||
|
||||
* Use logger.debug() to prevent the windows agent from dying
|
||||
* Make status() call synchronous
|
||||
|
||||
-- OpenGnsys developers <info@opengnsys.es> Thu, 17 Oct 2024 19:13:58 +0200
|
||||
|
||||
ogagent (1.4.3-1) stable; urgency=medium
|
||||
|
||||
* Use new OGBrowser
|
||||
|
|
|
@ -210,7 +210,7 @@ class OGASystemTray(QtWidgets.QSystemTrayIcon):
|
|||
valid_mods.append(mod)
|
||||
except Exception as e:
|
||||
logger.exception()
|
||||
logger.error("Activation of {} failed: {}".format(mod.name, utils.exceptionToMessage(e)))
|
||||
logger.debug ("Activation of {} failed: {}".format(mod.name, utils.exceptionToMessage(e)))
|
||||
self.modules[:] = valid_mods # copy instead of assignment
|
||||
# If this is running, it's because he have logged in, inform service of this fact
|
||||
self.ipc.sendLogin((operations.getCurrentUser(), operations.getSessionLanguage(),
|
||||
|
@ -223,7 +223,7 @@ class OGASystemTray(QtWidgets.QSystemTrayIcon):
|
|||
mod.deactivate()
|
||||
except Exception as e:
|
||||
logger.exception()
|
||||
logger.error("Deactivation of {} failed: {}".format(mod.name, utils.exceptionToMessage(e)))
|
||||
logger.debug ("Deactivation of {} failed: {}".format(mod.name, utils.exceptionToMessage(e)))
|
||||
|
||||
def timerFnc(self):
|
||||
pass
|
||||
|
@ -236,7 +236,7 @@ class OGASystemTray(QtWidgets.QSystemTrayIcon):
|
|||
logger.debug('msg: {}, {}'.format(type(msg), msg))
|
||||
module, message, data = msg
|
||||
except Exception as e:
|
||||
logger.error('Got exception {} processing message {}'.format(e, msg))
|
||||
logger.debug ('Got exception {} processing message {}'.format(e, msg))
|
||||
return
|
||||
|
||||
for v in self.modules:
|
||||
|
@ -246,9 +246,9 @@ class OGASystemTray(QtWidgets.QSystemTrayIcon):
|
|||
v.processMessage(message, json.loads(data))
|
||||
return
|
||||
except Exception as e:
|
||||
logger.error('Got exception {} processing generic message on {}'.format(e, v.name))
|
||||
logger.debug ('Got exception {} processing generic message on {}'.format(e, v.name))
|
||||
|
||||
logger.error('Module {} not found, messsage {} not sent'.format(module, message))
|
||||
logger.debug ('Module {} not found, messsage {} not sent'.format(module, message))
|
||||
|
||||
## when is this run??
|
||||
def executeScript(self, script):
|
||||
|
@ -271,7 +271,7 @@ class OGASystemTray(QtWidgets.QSystemTrayIcon):
|
|||
self.deinitialize()
|
||||
except Exception:
|
||||
logger.exception()
|
||||
logger.error('Got exception deinitializing modules')
|
||||
logger.debug ('Got exception deinitializing modules')
|
||||
|
||||
try:
|
||||
# If we close Client, send Logoff to Broker
|
||||
|
@ -282,10 +282,7 @@ class OGASystemTray(QtWidgets.QSystemTrayIcon):
|
|||
except Exception:
|
||||
# May we have lost connection with server, simply log and exit in that case
|
||||
logger.exception()
|
||||
# File "/home/nati/Downloads/work/opengnsys/ogagent/src/OGAgentUser.py", line 286, in cleanup
|
||||
# logger.exception("Got an exception, processing quit")
|
||||
#TypeError: Logger.exception() takes 1 positional argument but 2 were given
|
||||
#logger.exception("Got an exception, processing quit")
|
||||
logger.debug ('Got an exception, processing quit')
|
||||
|
||||
try:
|
||||
# operations.logoff() # Uncomment this after testing to logoff user
|
||||
|
@ -319,7 +316,7 @@ if __name__ == '__main__':
|
|||
trayIcon = OGASystemTray(app)
|
||||
except Exception as e:
|
||||
logger.exception()
|
||||
logger.error('OGA Service is not running, or it can\'t contact with OGA Server. User Tools stopped: {}'.format(
|
||||
logger.debug ('OGA Service is not running, or it can\'t contact with OGA Server. User Tools stopped: {}'.format(
|
||||
utils.exceptionToMessage(e)))
|
||||
sys.exit(1)
|
||||
|
||||
|
@ -327,7 +324,7 @@ if __name__ == '__main__':
|
|||
trayIcon.initialize() # Initialize modules, etc..
|
||||
except Exception as e:
|
||||
logger.exception()
|
||||
logger.error('Exception initializing OpenGnsys User Agent {}'.format(utils.exceptionToMessage(e)))
|
||||
logger.debug ('Exception initializing OpenGnsys User Agent {}'.format(utils.exceptionToMessage(e)))
|
||||
trayIcon.quit()
|
||||
sys.exit(1)
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
1.4.3
|
||||
1.4.4
|
||||
|
|
|
@ -96,22 +96,22 @@ class HTTPServerHandler(BaseHTTPRequestHandler):
|
|||
logger.exception()
|
||||
n_args = len (e.args)
|
||||
if 0 == n_args:
|
||||
logger.error ('Empty exception raised from message processor for "{}"'.format(path[0]))
|
||||
logger.debug ('Empty exception raised from message processor for "{}"'.format(path[0]))
|
||||
self.sendJsonError(500, exceptionToMessage(e))
|
||||
else:
|
||||
arg0 = e.args[0]
|
||||
if type (arg0) is str:
|
||||
logger.error ('Message processor for "{}" returned exception string "{}"'.format(path[0], str(e)))
|
||||
logger.debug ('Message processor for "{}" returned exception string "{}"'.format(path[0], str(e)))
|
||||
self.sendJsonError (500, exceptionToMessage(e))
|
||||
elif type (arg0) is dict:
|
||||
if '_httpcode' in arg0:
|
||||
logger.warning ('Message processor for "{}" returned HTTP code "{}" with exception string "{}"'.format(path[0], str(arg0['_httpcode']), str(arg0['_msg'])))
|
||||
logger.debug ('Message processor for "{}" returned HTTP code "{}" with exception string "{}"'.format(path[0], str(arg0['_httpcode']), str(arg0['_msg'])))
|
||||
self.sendJsonError (arg0['_httpcode'], arg0['_msg'])
|
||||
else:
|
||||
logger.error ('Message processor for "{}" returned exception dict "{}" with no HTTP code'.format(path[0], str(e)))
|
||||
logger.debug ('Message processor for "{}" returned exception dict "{}" with no HTTP code'.format(path[0], str(e)))
|
||||
self.sendJsonError (500, exceptionToMessage(e))
|
||||
else:
|
||||
logger.error ('Message processor for "{}" returned non-string and non-dict exception "{}"'.format(path[0], str(e)))
|
||||
logger.debug ('Message processor for "{}" returned non-string and non-dict exception "{}", type "{}"'.format(path[0], str(e), type(e)))
|
||||
self.sendJsonError (500, exceptionToMessage(e))
|
||||
## not reached
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ def check_secret(fnc):
|
|||
else:
|
||||
raise Exception('Unauthorized operation')
|
||||
except Exception as e:
|
||||
logger.error(str(e))
|
||||
logger.debug (str(e))
|
||||
raise Exception(e)
|
||||
|
||||
return wrapper
|
||||
|
@ -83,7 +83,7 @@ def execution_level(level):
|
|||
else:
|
||||
raise Exception('Unauthorized operation')
|
||||
except Exception as e:
|
||||
logger.error(str(e))
|
||||
logger.debug (str(e))
|
||||
raise Exception(e)
|
||||
|
||||
return wrapper
|
||||
|
|
|
@ -306,7 +306,9 @@ class ogAdmClientWorker (ogLiveWorker):
|
|||
|
||||
logger.info ('onActivation ok')
|
||||
|
||||
def do_status (self, post_params):
|
||||
@check_secret
|
||||
def process_status (self, path, get_params, post_params, server):
|
||||
logger.debug ('in process_status, path "{}" get_params "{}" post_params "{}" server "{}"'.format (path, get_params, post_params, server))
|
||||
cfg = self.LeeConfiguracion()
|
||||
thr_status = {}
|
||||
for k in self.thread_list:
|
||||
|
@ -322,11 +324,6 @@ class ogAdmClientWorker (ogLiveWorker):
|
|||
'threads': thr_status,
|
||||
}
|
||||
|
||||
@check_secret
|
||||
def process_status (self, path, get_params, post_params, server):
|
||||
logger.debug ('in process_status, path "{}" get_params "{}" post_params "{}" server "{}"'.format (path, get_params, post_params, server))
|
||||
return self._long_running_job ('status', self.do_status, args=(post_params,))
|
||||
|
||||
@check_secret
|
||||
def process_popup (self, path, get_params, post_params, server):
|
||||
logger.debug ('in process_popup, path "{}" get_params "{}" post_params "{}" server "{}"'.format (path, get_params, post_params, server))
|
||||
|
|
|
@ -139,7 +139,7 @@ class ogLiveWorker(ServerWorker):
|
|||
|
||||
def notifier (self, result):
|
||||
logger.debug (f'notifier() called, result ({result})')
|
||||
res = self.REST.sendMessage ('/'.join ([self.name, 'callback']), result)
|
||||
res = self.REST.sendMessage ('/clients/status/webhook', result)
|
||||
|
||||
def mon (self):
|
||||
while True:
|
||||
|
|
Loading…
Reference in New Issue