[X2Go-Commits] [python-x2go] 01/01: Capture broker connection problems during selectsession calls to the broker via a HOOK method.
git-admin at x2go.org
git-admin at x2go.org
Thu Apr 3 16:30:32 CEST 2014
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch master
in repository python-x2go.
commit 857f5f3bc560f99158181a7558a283cd0d681579
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Thu Apr 3 16:30:26 2014 +0200
Capture broker connection problems during selectsession calls to the broker via a HOOK method.
---
debian/changelog | 2 ++
x2go/client.py | 21 ++++++++++++++++++---
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 3daea6a..c088159 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -20,6 +20,8 @@ python-x2go (0.5.0.0-0x2go1) UNRELEASED; urgency=low
- Support cookie based authentication against a http(s) session broker.
- On Windows: Improve debugging when a new X-Server port has to be
allocated.
+ - Capture broker connection problems during selectsession calls to the
+ broker via a HOOK method.
* debian/control:
+ Add dependencies: python-requests, python-simplejson.
* python-x2go.spec:
diff --git a/x2go/client.py b/x2go/client.py
index 95fb444..428f352 100644
--- a/x2go/client.py
+++ b/x2go/client.py
@@ -383,6 +383,16 @@ class X2GoClient(object):
"""
self.logger('HOOK_profile_auto_connect: profile ,,%s'' wants to be auto-connected to the X2Go server.' % profile_name, loglevel=log.loglevel_WARN)
+ def HOOK_broker_connection_exception(self, profile_id='UNKNOWN'):
+ """\
+ HOOK method: called if a session demands to auto connect the session profile.
+
+ @param profile_id: profile ID of a session that triggered this hook method
+ @type profile_id: C{str}
+
+ """
+ self.logger('HOOK_profile_broker_connection_exception: a broker connection problem occurred triggered by an action on profile ,,%s''.' % self.session_profiles.to_profile_name(profile_id), loglevel=log.loglevel_WARN)
+
def HOOK_session_startup_failed(self, profile_name='UNKNOWN'):
"""\
HOOK method: called if the startup of a session failed.
@@ -922,9 +932,14 @@ class X2GoClient(object):
if k in kwargs.keys():
_params[k] = kwargs[k]
- server = self.session_profiles.get_server_hostname(_profile_id)
- _params['port'] = self.session_profiles.get_server_port(_profile_id)
- _pkey = self.session_profiles.get_pkey_object(_profile_id)
+ _pkey = None
+ try:
+ server = self.session_profiles.get_server_hostname(_profile_id)
+ _params['port'] = self.session_profiles.get_server_port(_profile_id)
+ _pkey = self.session_profiles.get_pkey_object(_profile_id)
+ except x2go_exceptions.X2GoBrokerConnectionException:
+ self.HOOK_broker_connection_exception(_profile_id)
+
if _pkey is not None:
self.logger('received PKey object for authentication, ignoring all other auth mechanisms', log.loglevel_NOTICE, tag=self._logger_tag)
_params['pkey'] = _pkey
--
Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/python-x2go.git
More information about the x2go-commits
mailing list