[X2Go-Commits] [x2gobroker] 16/17: x2gobroker/agent.py: Fix failing execution of LOCAL broker agent. As the LOCAL broker agent is executed setuid root, we cannot Popen.terminate() (which is unneeded anyway) the process after its execution.
git-admin at x2go.org
git-admin at x2go.org
Fri Dec 14 09:56:13 CET 2018
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch master
in repository x2gobroker.
commit 93a6974ec2fdd1c3a7958e815ab330ecaf1747bf
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Fri Dec 14 09:43:15 2018 +0100
x2gobroker/agent.py: Fix failing execution of LOCAL broker agent. As the LOCAL broker agent is executed setuid root, we cannot Popen.terminate() (which is unneeded anyway) the process after its execution.
---
debian/changelog | 4 ++++
x2gobroker/agent.py | 9 ++++++---
x2gobroker/brokers/base_broker.py | 4 ++--
3 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 6138397..752f29c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -92,6 +92,10 @@ x2gobroker (0.0.4.0-0x2go1) UNRELEASED; urgency=medium
- x2gobroker/tests/test_broker_agent.py: Assure that tests are run without
loadchecker usage.
- broker-use-load-checker profile option: Also tolerate 'TRUE' and 'True'.
+ - x2gobroker/agent.py: Fix failing execution of LOCAL broker agent. As
+ the LOCAL broker agent is executed setuid root, we cannot
+ Popen.terminate() (which is unneeded anyway) the process after its
+ execution.
* debian/*:
+ Trigger Makefile's install target and install those files. Drop debhelper
from-source-installation magic.
diff --git a/x2gobroker/agent.py b/x2gobroker/agent.py
index 935c330..22a5527 100644
--- a/x2gobroker/agent.py
+++ b/x2gobroker/agent.py
@@ -136,11 +136,14 @@ def _call_local_broker_agent(username, task, cmdline_args=[], logger=None):
stderr=subprocess.STDOUT,
shell=False,
)
-
result = agent_process.stdout.read().decode().split('\n')
- agent_process.terminate()
+
+ logger.info('Executing agent command succeeded.')
+ # skipping process terminating (not needed and not permitted
+ # as the broker agent is installed setuid root.
agent_process.communicate()
- except OSError:
+ except OSError as e:
+ logger.warning('Executing agent command failed. Error message is: {emsg}.'.format(emsg=str(e)))
result = None
if result:
diff --git a/x2gobroker/brokers/base_broker.py b/x2gobroker/brokers/base_broker.py
index d8e1847..562620c 100644
--- a/x2gobroker/brokers/base_broker.py
+++ b/x2gobroker/brokers/base_broker.py
@@ -1269,8 +1269,8 @@ class X2GoBroker(object):
if 'status' in profile and profile['status']:
logger_broker.debug('base_broker.X2GoBroker.get_profile_for_user(): marking session profile {name} as {status}'.format(name=profile['name'], status=profile['status']))
- except x2gobroker.x2gobroker_exceptions.X2GoBrokerAgentException:
- pass
+ except x2gobroker.x2gobroker_exceptions.X2GoBrokerAgentException as e:
+ logger_broker.warning('base_broker.X2GoBroker.get_profile_for_user(): broker agent call failed. Error message is: {errmsg}'.format(errmsg=str(e)))
else:
profile['host'] = [profile['host'][0]]
--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gobroker.git
More information about the x2go-commits
mailing list