[X2go-Commits] python-x2go.git - master (branch) updated: 0.1.1.2-5-gd5f871b

X2go dev team git-admin at x2go.org
Wed Jul 6 17:20:32 CEST 2011


The branch, master has been updated
       via  d5f871ba0fa17cd63dc3bca118844ec74f3ebb03 (commit)
       via  c84844dfe09359d4f113a533f89362581a0eb947 (commit)
       via  481acc6867d37250684a1530c24b32fa3dbd49ae (commit)
      from  6192724a528b0d585823170f54c2eced49098169 (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 d5f871ba0fa17cd63dc3bca118844ec74f3ebb03
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Wed Jul 6 17:21:00 2011 +0200

    Stabilize desktop sharing if the remote session is not available.

commit c84844dfe09359d4f113a533f89362581a0eb947
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Wed Jul 6 17:20:09 2011 +0200

    Do not allow any interruption during X2go cleanup calls.

commit 481acc6867d37250684a1530c24b32fa3dbd49ae
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Wed Jul 6 17:18:27 2011 +0200

    Fix AttributeError if no graphical proxy instance has been declared yet.

-----------------------------------------------------------------------

Summary of changes:
 debian/changelog                  |    3 ++
 x2go/backends/terminal/_stdout.py |    3 +-
 x2go/cleanup.py                   |   68 ++++++++++++++++++++----------------
 x2go/client.py                    |   12 +++++--
 x2go/session.py                   |   16 +++++++-
 5 files changed, 66 insertions(+), 36 deletions(-)

The diff of changes is:
diff --git a/debian/changelog b/debian/changelog
index ce5e92e..9ca8382 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,9 @@ python-x2go (0.1.1.3-0~x2go1) UNRELEASED; urgency=low
     - README/TODO update.
     - Desktop sharing: try ''<user>@<display>.0'' additionally to ''<user>@<display>'' when
       trying to find a desktop for sharing.
+    - Fix AttributeError if no graphical proxy instance has been declared yet.
+    - Do not allow any interruption during X2go cleanup calls.
+    - Stabilize desktop sharing if the remote session is not available.
 
  -- Mike Gabriel <mike.gabriel at das-netzwerkteam.de>  Fri, 01 Jul 2011 14:53:48 +0200
 
diff --git a/x2go/backends/terminal/_stdout.py b/x2go/backends/terminal/_stdout.py
index 4c439fd..24fc74e 100644
--- a/x2go/backends/terminal/_stdout.py
+++ b/x2go/backends/terminal/_stdout.py
@@ -962,5 +962,6 @@ class X2goTerminalSessionSTDOUT(object):
         STILL UNDOCUMENTED
 
         """
-        self.proxy.__del__()
+        if self.proxy is not None:
+            self.proxy.__del__()
 
diff --git a/x2go/cleanup.py b/x2go/cleanup.py
index 8b72614..ab28fe6 100644
--- a/x2go/cleanup.py
+++ b/x2go/cleanup.py
@@ -62,39 +62,47 @@ def x2go_cleanup(e=None, threads=None):
     @type threads: C{list}
 
     """
-    if threads is None:
-        threads = threading.enumerate()
-    else:
-        threads = threads
-
-    # stop X2go reverse forwarding tunnels
-    for t in threads:
-        if type(t) == rforward.X2goRevFwTunnel:
-            t.stop_thread()
-            del t
-
-    # stop X2go paramiko transports used by X2goTerminalSession objects
-    for t in threads:
-        if type(t) == paramiko.Transport:
-            if hasattr(t, '_x2go_session_marker'):
-                t.stop_thread()
-                del t
+    try:
+        if threads is None:
+            threads = threading.enumerate()
+        else:
+            threads = threads
 
-    # on Windows: stop the XServer that we evoked
-    if _X2GOCLIENT_OS == 'Windows':
+        # stop X2go reverse forwarding tunnels
         for t in threads:
-            if type(t) == xserver.X2goXServer:
+            if type(t) == rforward.X2goRevFwTunnel:
                 t.stop_thread()
-                gevent.sleep(1)
                 del t
 
-    # on Windows: stop the PulseAudio daemon that we evoked
-    if _X2GOCLIENT_OS == 'Windows':
+        # stop X2go paramiko transports used by X2goTerminalSession objects
         for t in threads:
-            if type(t) == pulseaudio.X2goPulseAudio:
-                t.stop_thread()
-                gevent.sleep(1)
-                del t
-
-    if e is not None:
-        raise e
+            if type(t) == paramiko.Transport:
+                if hasattr(t, '_x2go_session_marker'):
+                    t.stop_thread()
+                    del t
+
+        # on Windows: stop the XServer that we evoked
+        if _X2GOCLIENT_OS == 'Windows':
+            for t in threads:
+                if type(t) == xserver.X2goXServer:
+                    t.stop_thread()
+                    gevent.sleep(1)
+                    del t
+
+        # on Windows: stop the PulseAudio daemon that we evoked
+        if _X2GOCLIENT_OS == 'Windows':
+            for t in threads:
+                if type(t) == pulseaudio.X2goPulseAudio:
+                    t.stop_thread()
+                    gevent.sleep(1)
+                    del t
+
+        if e is not None:
+            raise e
+
+    except KeyboardInterrupt:
+        # do not allow keyboard interrupts during Python X2go cleanup
+        pass
+    except SystemExit:
+        # neither do we allow SIGTERM signals during cleanup...
+        pass
diff --git a/x2go/client.py b/x2go/client.py
index eba5515..d7e6fb1 100644
--- a/x2go/client.py
+++ b/x2go/client.py
@@ -1200,14 +1200,20 @@ class X2goClient(object):
         """
 
         # X2goClient.list_desktops() uses caching (if enabled, so we prefer lookups here...
-        _desktop = desktop or "%s@%s" % (user, display)
+        if desktop:
+            _desktop = desktop
+            user = None
+            display = None
+        else:
+            _desktop = '%s@%s' % (user, display)
+
         if not _desktop in self._X2goClient__list_desktops(session_uuid):
             _orig_desktop = _desktop
-            _desktop = desktop or '%s.0' % _desktop
+            _desktop = '%s.0' % _desktop
             if not _desktop in self._X2goClient__list_desktops(session_uuid):
                 raise x2go_exceptions.X2goDesktopSharingException('No such desktop ID: %s' % _orig_desktop)
 
-        return self.session_registry(session_uuid).share_desktop(desktop=desktop, user=user, display=display, share_mode=share_mode, check_desktop_list=False)
+        return self.session_registry(session_uuid).share_desktop(desktop=_desktop, share_mode=share_mode, check_desktop_list=False)
     __share_desktop_session = share_desktop_session
 
     def resume_session(self, session_uuid=None, session_name=None):
diff --git a/x2go/session.py b/x2go/session.py
index 9b9704e..d4500d1 100644
--- a/x2go/session.py
+++ b/x2go/session.py
@@ -1099,10 +1099,22 @@ class X2goSession(object):
                 if not _desktop in self._X2GoSession__list_desktops():
                     raise X2goDesktopSharingException('No such desktop ID: %s' % _orig_desktop)
 
+        _session_owner = _desktop.split('@')[0]
+        _display = _desktop.split('@')[1]
+
         if self.is_alive():
+            if self.get_username() != _session_owner:
+                self.logger('waiting for user ,,%s\'\' to interactively grant you access to his/her desktop session...' % _session_owner, loglevel=log.loglevel_NOTICE)
+                self.logger('THIS MAY TAKE A WHILE!', loglevel=log.loglevel_NOTICE)
+
             _control = self.control_session
-            self.terminal_session = _control.share_desktop(desktop=desktop, user=user, display=display, share_mode=share_mode,
-                                                           logger=self.logger, **self.terminal_params)
+            try:
+                self.terminal_session = _control.share_desktop(desktop=_desktop, share_mode=share_mode,
+                                                               logger=self.logger, **self.terminal_params)
+            except ValueError:
+                # x2gostartagent output parsing will result in a ValueError. This one we will catch
+                # here and change it into an X2goSessionException
+                raise X2goSessionException('the session on desktop %s is seemingly dead' % _desktop)
 
             if self.has_terminal_session():
                 self.session_name = self.terminal_session.session_info.name


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