[X2Go-Commits] python-x2go.git - release/0.4.0.x (branch) updated: 0.1.1.4-164-g521d91d
X2Go dev team
git-admin at x2go.org
Tue Jan 7 16:17:47 CET 2014
The branch, release/0.4.0.x has been updated
via 521d91dfd683e3221ba0d37d24c5419f4dfb4852 (commit)
from 41e9e07ffcd534af310b1a7dd48c04d9fbd72356 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
-----------------------------------------------------------------------
Summary of changes:
debian/changelog | 3 +++
x2go/backends/terminal/_stdout.py | 7 +++++++
x2go/client.py | 22 ++++++++++++++++++++
x2go/session.py | 41 ++++++++++++++++++++++++++++++++++---
4 files changed, 70 insertions(+), 3 deletions(-)
The diff of changes is:
diff --git a/debian/changelog b/debian/changelog
index a9594b0..785a616 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -72,6 +72,9 @@ python-x2go (0.1.2.0-0~x2go1) UNRELEASED; urgency=low
- Docstring fix, add X2goClient method is_session_profile(), return registered
session for a specific session name if it has already been registered instead
of registering a new session.
+ - Provide X2goClient method get_session_info(), do not auto start/resume sessions
+ in published applications mode, provide hook method for auto-connecting
+ interactively.
* Depend on python-xlib.
-- Mike Gabriel <mike.gabriel at das-netzwerkteam.de> Sat, 28 Sep 2012 01:44:21 +0100
diff --git a/x2go/backends/terminal/_stdout.py b/x2go/backends/terminal/_stdout.py
index 32798af..6cfbac1 100644
--- a/x2go/backends/terminal/_stdout.py
+++ b/x2go/backends/terminal/_stdout.py
@@ -393,6 +393,13 @@ class X2goTerminalSessionSTDOUT(object):
"""
return self.session_info.name
+ def get_session_info(self):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ return self.session_info
+
def get_session_cmd(self):
"""\
STILL UNDOCUMENTED
diff --git a/x2go/client.py b/x2go/client.py
index 68da3fb..ef04361 100644
--- a/x2go/client.py
+++ b/x2go/client.py
@@ -331,6 +331,13 @@ class X2goClient(object):
self.auto_update_listdesktops_cache = auto_update_listdesktops_cache
self.auto_update_listmounts_cache = auto_update_listmounts_cache
+ def HOOK_profile_auto_connect(self, profile_name='UNKNOWN'):
+ """\
+ HOOK method: called if a session demands to auto connect the session profile.
+
+ """
+ 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_session_startup_failed(self, profile_name='UNKNOWN'):
"""\
HOOK method: called if the startup of a session failed.
@@ -1071,6 +1078,21 @@ class X2goClient(object):
return self.session_registry(session_uuid).get_session_name()
__get_session_name = get_session_name
+ def get_session_info(self, session_uuid):
+ """\
+ Retrieve the server-side X2Go session information object for the session that has
+ been registered under C{session_uuid}.
+
+ @param session_uuid: the X2Go session's UUID registry hash
+ @type session_uuid: C{str}
+
+ @return: X2Go session info
+ @rtype: C{obj}
+
+ """
+ return self.session_registry(session_uuid).get_session_info()
+ __get_session_info = get_session_info
+
def set_session_username(self, session_uuid, username):
"""\
Set the session username for the L{X2goSession} that has been registered under C{session_uuid}.
diff --git a/x2go/session.py b/x2go/session.py
index 1bbea20..8ec10f0 100644
--- a/x2go/session.py
+++ b/x2go/session.py
@@ -308,6 +308,16 @@ class X2goSession(object):
if self.is_connected():
self.retrieve_server_features()
+ def HOOK_auto_connect(self):
+ """\
+ HOOK method: called if the session demands to auto connect.
+
+ """
+ if self.client_instance:
+ self.client_instance.HOOK_profile_auto_connect(profile_name=self.profile_name)
+ else:
+ self.logger('HOOK_auto_connect: profile ,,%s'' wants to auto-connect to the X2Go server.' % self.profile_name, loglevel=log.loglevel_WARN)
+
def HOOK_session_startup_failed(self):
"""\
HOOK method: called if the startup of a session failed.
@@ -716,6 +726,18 @@ class X2goSession(object):
return self.session_name
__get_session_name = get_session_name
+ def get_session_info(self):
+ """\
+ Retrieve the server-side X2Go session info object for this session.
+
+ @return: X2Go session info
+ @rtype: C{obj}
+
+ """
+ if self.has_terminal_session():
+ self.terminal_session.get_session_info()
+ __get_session_info = get_session_info
+
def get_session_cmd(self):
"""\
Retrieve the server-side command that is used to start a session
@@ -890,6 +912,8 @@ class X2goSession(object):
else:
if self.can_auto_connect() and self.auto_connect:
gevent.spawn(self.connect)
+ else:
+ gevent.spawn(self.HOOK_auto_connect)
def connect(self, username='', password='', add_to_known_hosts=False, force_password_auth=False,
use_sshproxy=False, sshproxy_user='', sshproxy_password=''):
@@ -1296,7 +1320,11 @@ class X2goSession(object):
def do_auto_start_or_resume(self, newest=True, oldest=False, all_suspended=False, start=True, redirect_to_client=True):
"""\
- Automatically start or resume this session.
+ Automatically start or resume this session, if already associated with a server session. Otherwise
+ resume a server-side available/suspended session (see options to declare which session to resume).
+ If no session is available for resuming a new session will be launched.
+
+ Sessions in published applications mode are not resumed/started by this method.
@param newest: if resuming, only resume newest/youngest session
@type newest: C{bool}
@@ -1314,10 +1342,16 @@ class X2goSession(object):
if self.client_instance and redirect_to_client:
return self.client_instance.session_auto_start_or_resume(self())
else:
- if self.session_name is not None:
+ if self.session_name is not None and 'PUBLISHED' not in self.session_name:
return self.resume()
else:
session_infos = self.list_sessions()
+
+ # only auto start/resume non-pubapp sessions
+ for session_name in session_infos.keys():
+ if session_infos[session_name].is_published_applications_provider():
+ del session_infos[session_name]
+
if session_infos:
if newest:
return self.resume(session_name=utils.session_names_by_timestamp(session_infos)[-1])
@@ -1327,7 +1361,8 @@ class X2goSession(object):
for session_name in [ _sn for _sn in session_infos.keys() if session_infos[_sn].is_suspended() ]:
return self.resume(session_name=session_name)
else:
- return self.start()
+ if not self.published_applications:
+ return self.start()
def resume(self, session_name=None):
"""\
hooks/post-receive
--
python-x2go.git (Python X2Go Client API)
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "python-x2go.git" (Python X2Go Client API).
More information about the x2go-commits
mailing list