From 860fb6167785e68661b5f07defba42fa3b420159 Mon Sep 17 00:00:00 2001 From: Natalia Serrano Date: Mon, 4 Aug 2025 12:25:56 +0200 Subject: [PATCH 1/4] refs #2562 keep track of the logging-out user --- src/opengnsys/ipc.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/opengnsys/ipc.py b/src/opengnsys/ipc.py index 077d6c3..1399776 100644 --- a/src/opengnsys/ipc.py +++ b/src/opengnsys/ipc.py @@ -110,6 +110,11 @@ class ClientProcessor(threading.Thread): logger.debug('Got Client message {}={}'.format(msg, REV_DICT.get(msg))) if self.parent.clientMessageProcessor is not None: self.parent.clientMessageProcessor(msg, data) + if msg == REQ_LOGIN: + if b',' in data: + self.user = data.split (b',')[0] + else: + self.user = data def run(self): self.running = True @@ -197,8 +202,14 @@ class ClientProcessor(threading.Thread): logger.error('Invalid message in queue: {}'.format(e)) logger.debug('Client processor stopped') - if os.path.exists ('/windows/temp'): open ('/windows/temp/ogagentuser_died', 'w').close() - else: open ( '/tmp/ogagentuser_died', 'w').close() + if os.path.exists ('/windows/temp'): + fd = open ('/windows/temp/ogagentuser_died', 'wb') + fd.write (self.user) + fd.close() + else: + fd = open ('/tmp/ogagentuser_died', 'wb') + fd.write (self.user) + fd.close() try: self.clientSocket.close() except Exception: -- 2.40.1 From fc8b072860580c6cd84446b623c8c198ba2d0c8e Mon Sep 17 00:00:00 2001 From: Natalia Serrano Date: Mon, 4 Aug 2025 12:26:19 +0200 Subject: [PATCH 2/4] refs #2563 log the logging-out user --- src/opengnsys/linux/OGAgentService.py | 4 +++- src/opengnsys/windows/OGAgentService.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/opengnsys/linux/OGAgentService.py b/src/opengnsys/linux/OGAgentService.py index c1962a0..d6601d6 100755 --- a/src/opengnsys/linux/OGAgentService.py +++ b/src/opengnsys/linux/OGAgentService.py @@ -74,10 +74,12 @@ class OGAgentSvc(Daemon, CommonService): while self.isAlive: client_died=False if os.path.exists ('/tmp/ogagentuser_died'): + with open ('/tmp/ogagentuser_died', 'rb') as fd: + u = fd.read() os.unlink ('/tmp/ogagentuser_died') client_died=True if client_died: - self.notifyLogout (b'') + self.notifyLogout (u) # In milliseconds, will break self.doWait(1000) diff --git a/src/opengnsys/windows/OGAgentService.py b/src/opengnsys/windows/OGAgentService.py index 7529b38..1ce3142 100644 --- a/src/opengnsys/windows/OGAgentService.py +++ b/src/opengnsys/windows/OGAgentService.py @@ -108,10 +108,12 @@ class OGAgentSvc(win32serviceutil.ServiceFramework, CommonService): while self.isAlive: client_died=False if os.path.exists ('/windows/temp/ogagentuser_died'): + with open ('/windows/temp/ogagentuser_died', 'rb') as fd: + u = fd.read() os.unlink ('/windows/temp/ogagentuser_died') client_died=True if client_died: - self.notifyLogout (b'') + self.notifyLogout (u) # Pumps & processes any waiting messages pythoncom.PumpWaitingMessages() -- 2.40.1 From 25b2cb6cd8e8bfaf0f21ed1a618842877b8a1599 Mon Sep 17 00:00:00 2001 From: Natalia Serrano Date: Mon, 4 Aug 2025 14:21:04 +0200 Subject: [PATCH 3/4] refs #2558 #2559 return job_id to ogcore --- .../modules/client/OpenGnSys/__init__.py | 4 +-- .../modules/server/OpenGnSys/__init__.py | 26 +++++++++++++++++-- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/opengnsys/modules/client/OpenGnSys/__init__.py b/src/opengnsys/modules/client/OpenGnSys/__init__.py index 39c3928..d78aeb3 100644 --- a/src/opengnsys/modules/client/OpenGnSys/__init__.py +++ b/src/opengnsys/modules/client/OpenGnSys/__init__.py @@ -50,8 +50,8 @@ class OpenGnSysWorker(ClientWorker): def process_script(self, json_params): script = json_params['code'] logger.debug('Processing message: script({})'.format(script)) - self.jobmgr.launch_job (script, True) - #self.sendServerMessage('script', {'op', 'launched'}) + job_id = self.jobmgr.launch_job (script, True) + self.sendServerMessage('script_launched', {'op': 'launched', 'job_id': job_id}) def process_terminatescript(self, json_params): job_id = json_params['job_id'] diff --git a/src/opengnsys/modules/server/OpenGnSys/__init__.py b/src/opengnsys/modules/server/OpenGnSys/__init__.py index 350b4ca..ceb0c3e 100644 --- a/src/opengnsys/modules/server/OpenGnSys/__init__.py +++ b/src/opengnsys/modules/server/OpenGnSys/__init__.py @@ -375,8 +375,30 @@ class OpenGnSysWorker(ServerWorker): else: ## post_params.get('client') is not 'false' ## send script as-is self.sendClientMessage('script', {'code': script}) - #return {'op': 'launched', 'job_id': job_id} ## TODO obtain job_id generated at the client (can it be done?) - return {'op': 'launched'} + + ## wait for job_id generated at the client + job_id = None + iters = 0 + while True: + time.sleep (0.2) + if os.path.exists ('/tmp/EjecutarScript-jobid'): + with open ('/tmp/EjecutarScript-jobid', 'r') as fd: + job_id = fd.read() + break + iters += 1 + if iters >= 10: break + + try: os.unlink ('/tmp/EjecutarScript-jobid'): + except: pass + + if job_id is None: return {'op': 'launched'} + else: return {'op': 'launched', 'job_id': job_id} + + def process_client_script_launched(self, data): + fd = open ('/tmp/EjecutarScript-jobid', 'w') + fd.write (data['job_id']) + fd.close() + return True @execution_level('full') @check_secret -- 2.40.1 From 8b8204d10fd2cf9ce1d3bd461840b67d0b8e6475 Mon Sep 17 00:00:00 2001 From: Natalia Serrano Date: Mon, 4 Aug 2025 14:24:22 +0200 Subject: [PATCH 4/4] refs #2558 #2559 #2562 #2563 add versioning stuff --- CHANGELOG.md | 7 +++++++ linux/debian/changelog | 7 +++++++ src/VERSION | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bedb8d9..e60bfac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [7.3.1] - 2025-08-04 + +### Fixed + +- On user logout, write the user to the log +- On EjecutarScript with client=true, return a job ID + ## [7.3.0] - 2025-07-31 ### Fixed diff --git a/linux/debian/changelog b/linux/debian/changelog index 7437ef0..ab378f5 100644 --- a/linux/debian/changelog +++ b/linux/debian/changelog @@ -1,3 +1,10 @@ +ogagent (7.3.1-1) stable; urgency=medium + + * On user logout, write the user to the log + * On EjecutarScript with client=true, return a job ID + + -- OpenGnsys developers Mon, 04 Aug 2025 14:22:52 +0200 + ogagent (7.3.0-1) stable; urgency=medium * Wait for zombies diff --git a/src/VERSION b/src/VERSION index 1502020..643916c 100644 --- a/src/VERSION +++ b/src/VERSION @@ -1 +1 @@ -7.3.0 +7.3.1 -- 2.40.1