This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2gobroker. commit 214ddadd62b6d5ba0e6b2e9dbd38563bbbc9f233 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Thu Sep 11 23:59:47 2014 +0200 On session resumption take profile's host list into account. Don't resume sessions the profile has not been configured for. (Fixes: #553). --- debian/changelog | 2 ++ x2gobroker/brokers/base_broker.py | 50 +++++++++++++++++++++---------------- 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/debian/changelog b/debian/changelog index 4f207a1..cfe0cf4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -199,6 +199,8 @@ x2gobroker (0.0.3.0-0x2go1) UNRELEASED; urgency=low - Fix typos and host/port mixups in the remote_sshproxy logic. (Fixes: #544). - Make sure find_busy_servers in agent.py returns a tuple (recent API change) to not break profiles with multiple servers. (Fixes: #545). + - On session resumption take profile's host list into account. Don't resume + sessions the profile has not been configured for. (Fixes: #553). -- Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Fri, 07 Jun 2013 23:25:30 +0200 diff --git a/x2gobroker/brokers/base_broker.py b/x2gobroker/brokers/base_broker.py index b72576d..ea48f77 100644 --- a/x2gobroker/brokers/base_broker.py +++ b/x2gobroker/brokers/base_broker.py @@ -1092,28 +1092,34 @@ class X2GoBroker(object): running_sessions = [] suspended_sessions = [] for session_info in session_list: - if session_info.split('|')[4] == 'R': - running_sessions.append(session_info) - if session_info.split('|')[4] == 'S': - suspended_sessions.append(session_info) - - # we prefer suspended sessions over resuming sessions if we find sessions with both - # states of activity - if suspended_sessions: - session_info = suspended_sessions[0] - elif running_sessions: - session_info = running_sessions[0] - x2gobroker.agent.suspend_session(username=username, session_name=session_info.split('|')[1], remote_agent=remote_agent) - # this is the turn-around in x2gocleansessions, so waiting as along as the daemon - # that will suspend the session - time.sleep(2) - session_info = session_info.replace('|R|', '|S|') - - # only use the server's official hostname (as set on the server) - # if we know about the real/physical address of the server - _session_server_name = session_info.split('|')[3] - if profile.has_key('host={server_name}'.format(server_name=_session_server_name)): - server_name = _session_server_name + session_host, session_domain = session_info.split('|')[3].split('.', 1) + if session_host in server_list: + if session_info.split('|')[4] == 'R': + running_sessions.append(session_info) + if session_info.split('|')[4] == 'S': + suspended_sessions.append(session_info) + + if suspended_sessions or running_sessions: + # we prefer suspended sessions over resuming sessions if we find sessions with both + # states of activity + if suspended_sessions: + session_info = suspended_sessions[0] + elif running_sessions: + session_info = running_sessions[0] + x2gobroker.agent.suspend_session(username=username, session_name=session_info.split('|')[1], remote_agent=remote_agent) + # this is the turn-around in x2gocleansessions, so waiting as along as the daemon + # that will suspend the session + time.sleep(2) + session_info = session_info.replace('|R|', '|S|') + + # only use the server's official hostname (as set on the server) + # if we have been provided with a physical server address. + # If no physical server address has been provided, we have to use + # the host address as found in server_list (and hope we can connect + # to that address. + _session_server_name = session_info.split('|')[3] + if profile.has_key('host={server_name}'.format(server_name=_session_server_name)): + server_name = _session_server_name except IndexError: # FIXME: if we get here, we have to deal with a broken session info -- Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/x2gobroker.git