[X2go-Commits] python-x2go.git - release/0.1.1.x (branch) updated: 0.1.1.6-17-g38dbb69
X2go dev team
git-admin at x2go.org
Sat Sep 24 11:39:25 CEST 2011
The branch, release/0.1.1.x has been updated
via 38dbb697abfb29908554824ce34b000173322775 (commit)
via 8e23ff85e4203e551a109d354284b86ee015d905 (commit)
from d1064100febd0837fa8b6d66b8efd13deb5780d0 (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 -----------------------------------------------------------------
commit 38dbb697abfb29908554824ce34b000173322775
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Sat Sep 24 04:28:30 2011 +0200
Provide test method to query server if folder sharing is available. Test for existence of remote home directory on connect.
commit 8e23ff85e4203e551a109d354284b86ee015d905
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Sat Sep 24 04:29:52 2011 +0200
log message fix
-----------------------------------------------------------------------
Summary of changes:
debian/changelog | 2 ++
x2go/backends/control/_stdout.py | 15 +++++++++++++++
x2go/backends/terminal/_stdout.py | 9 +++++++--
x2go/client.py | 27 +++++++++++++++++++++++++++
4 files changed, 51 insertions(+), 2 deletions(-)
The diff of changes is:
diff --git a/debian/changelog b/debian/changelog
index c0f9023..a8a6011 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -18,6 +18,8 @@ python-x2go (0.1.1.7-0-x2go1) UNRELEASED; urgency=low
method.
- Compatibility fix for X2go folder sharing (session profile attribute:
export).
+ - Provide test method to query server if folder sharing is available.
+ - Test for existence of remote home directory on connect.
[ Dick Kniep ]
* Fix for upstream version 0.1.1.7:
diff --git a/x2go/backends/control/_stdout.py b/x2go/backends/control/_stdout.py
index 4936189..e382493 100644
--- a/x2go/backends/control/_stdout.py
+++ b/x2go/backends/control/_stdout.py
@@ -256,6 +256,11 @@ class X2goControlSessionSTDOUT(paramiko.SSHClient):
#return username in self._x2go_remote_group('x2gousers')
return True
+ def is_folder_sharing_available(self):
+ if self.remote_username() in self._x2go_remote_group('fuse'):
+ return True
+ return False
+
def remote_username(self):
"""\
Returns the control session's remote username.
@@ -486,6 +491,10 @@ class X2goControlSessionSTDOUT(paramiko.SSHClient):
if self.get_transport():
self.session_died = False
+
+ if not self.home_exists():
+ raise x2go_exceptions.X2goControlSessionException('remote home directory does not exist')
+
return (self.get_transport() is not None)
def dissociate(self, terminal_session):
@@ -540,6 +549,12 @@ class X2goControlSessionSTDOUT(paramiko.SSHClient):
return False
+ def home_exists(self):
+ if self._x2go_exec_command('stat -tL "%s"', loglevel=log.loglevel_DEBUG):
+ return True
+ return False
+
+
def is_alive(self):
if self._x2go_exec_command('echo', loglevel=log.loglevel_DEBUG):
return True
diff --git a/x2go/backends/terminal/_stdout.py b/x2go/backends/terminal/_stdout.py
index af8212c..73a2844 100644
--- a/x2go/backends/terminal/_stdout.py
+++ b/x2go/backends/terminal/_stdout.py
@@ -439,12 +439,17 @@ class X2goTerminalSessionSTDOUT(object):
# tunnel has already been started and might simply need a resume call
self.reverse_tunnels[self.session_info.name]['snd'][1].resume()
+ def is_folder_sharing_available(self):
+ if self.session_info.username in self.control_session._x2go_remote_group('fuse'):
+ return True
+ return False
+
def start_sshfs(self):
"""\
Initialize Paramiko/SSH reverse forwarding tunnel for X2go folder sharing.
"""
- if self.session_info.username not in self.control_session._x2go_remote_group('fuse'):
+ if self.is_folder_sharing_available():
raise x2go_exceptions.X2goUserException('remote user %s is not member of X2go server group fuse' % self.session_info.username)
# start reverse SSH tunnel for sshfs (folder sharing, printing)
@@ -591,7 +596,7 @@ class X2goTerminalSessionSTDOUT(object):
@rtype: bool
"""
- if self.session_info.username not in self.control_session._x2go_remote_group('fuse'):
+ if self.is_folder_sharing_available():
raise x2go_exceptions.X2goUserException('remote user %s is not member of X2go server group fuse' % self.session_info.username)
if local_path is None:
diff --git a/x2go/client.py b/x2go/client.py
index 5914918..0d4061b 100644
--- a/x2go/client.py
+++ b/x2go/client.py
@@ -1470,6 +1470,33 @@ class X2goClient(object):
return session_name not in [ s for s in self.server_running_sessions(session_uuid) + self.server_suspended_sessions(session_uuid) ]
__has_session_terminated = has_session_terminated
+ def is_folder_sharing_available(self, session_uuid=None, profile_name=None):
+ """\
+ Test if local folder sharing is available for X2go session with unique ID <session_uuid> or
+ session profile <profile_name>.
+
+ @param session_uuid: the X2go session's UUID registry hash
+ @type session_uuid: C{str}
+ @param profile_name: alternatively, the profile name can be used to perform this query
+ @type profile_name: C{str}
+
+ @return: returns C{True} if the profile/session supports local folder sharing
+ @rtype: C{bool}
+
+ """
+ if session_uuid is None and profile_name:
+ _connected = self._X2goClient__client_connected_sessions_of_profile_name(profile_name, return_objects=False)
+ if len(_connected) > 0:
+ session_uuid = _connected[0]
+ if session_uuid:
+ return self.session_registry(session_uuid).is_folder_sharing_available()
+ else:
+ self.logger('Cannot find a terminal session for profile ,,%s\'\' that can be used to query folder sharing capabilities' % profile_name, loglevel=log.loglevel_WARN)
+ return False
+ __is_folder_sharing_available = is_folder_sharing_available
+ __profile_is_folder_sharing_available = is_folder_sharing_available
+ __session_is_folder_sharing_available = is_folder_sharing_available
+
def share_local_folder(self, session_uuid=None, local_path=None, profile_name=None, folder_name=None):
"""\
Share a local folder with the X2go session registered as C{session_uuid}.
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