[X2Go-Commits] python-x2go.git - twofactorauth (branch) updated: fa7770f32da51e5ffba31f795308554bae9849cb

X2Go dev team git-admin at x2go.org
Sat Sep 14 15:55:48 CEST 2013


The branch, twofactorauth has been updated
       via  fa7770f32da51e5ffba31f795308554bae9849cb (commit)
      from  7037e4a2e16e74ec73fa55cdcd4a2840a97e4cea (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:
 x2go/backends/terminal/_stdout.py |   38 +++++++++++++++++++++----------------
 x2go/client.py                    |    2 ++
 2 files changed, 24 insertions(+), 16 deletions(-)

The diff of changes is:
diff --git a/x2go/backends/terminal/_stdout.py b/x2go/backends/terminal/_stdout.py
index e1b48e5..af1c98e 100644
--- a/x2go/backends/terminal/_stdout.py
+++ b/x2go/backends/terminal/_stdout.py
@@ -365,20 +365,24 @@ class X2goTerminalSessionSTDOUT(object):
                 ###
                 ### PULSEAUDIO
                 ###
-                # setup pulse client config file on X2go server
-                cmd_line = "echo 'default-server=localhost:%s'>%s/.pulse-client.conf;" % (self.session_info.snd_port, self.session_info.remote_container) + \
-                           "echo 'cookie-file=%s/.pulse-cookie'>>%s/.pulse-client.conf" % (self.session_info.remote_container, self.session_info.remote_container)
-                (stdin, stdout, stderr) = self.control_session._x2go_exec_command(cmd_line)
-
-                self.control_session._x2go_sftp_put(local_path='%s/.pulse-cookie' % _LOCAL_HOME, remote_path='%s/.pulse-cookie' % self.session_info.remote_container)
-
-                # start reverse SSH tunnel for pulse stream
-                _tunnel = rforward.X2goRevFwTunnel(server_port=self.session_info.snd_port, 
-                                                   remote_host='localhost', 
-                                                   remote_port=4713, 
-                                                   ssh_transport=self.control_session.get_transport(),
-                                                   logger=self.logger
-                                                  )
+                if os.path.exists(os.path.normpath(local_path='%s/.pulse-cookie' % _LOCAL_HOME)):
+                    # setup pulse client config file on X2go server
+                    cmd_line = "echo 'default-server=localhost:%s'>%s/.pulse-client.conf;" % (self.session_info.snd_port, self.session_info.remote_container) + \
+                               "echo 'cookie-file=%s/.pulse-cookie'>>%s/.pulse-client.conf" % (self.session_info.remote_container, self.session_info.remote_container)
+                    (stdin, stdout, stderr) = self.control_session._x2go_exec_command(cmd_line)
+
+                    self.control_session._x2go_sftp_put(local_path='%s/.pulse-cookie' % _LOCAL_HOME, remote_path='%s/.pulse-cookie' % self.session_info.remote_container)
+
+                    # start reverse SSH tunnel for pulse stream
+                    _tunnel = rforward.X2goRevFwTunnel(server_port=self.session_info.snd_port, 
+                                                       remote_host='localhost', 
+                                                       remote_port=4713, 
+                                                       ssh_transport=self.control_session.get_transport(),
+                                                       logger=self.logger
+                                                      )
+                else:
+                    if self.client_instance:
+                        self.client_instance.HOOK_on_sound_tunnel_failed(profile_name=self.profile_name, session_name=self.session_info.name)
 
             elif self.params.snd_system == 'arts':
                 ###
@@ -666,7 +670,8 @@ class X2goTerminalSessionSTDOUT(object):
 
         """
         if not self.has_command(_rewrite_cmd(self.params.cmd)):
-            self.client_instance.HOOK_no_such_command(profile_name=self.profile_name, session_name=self.session_info.name, cmd=self.params.cmd)
+            if self.client_instance:
+                self.client_instance.HOOK_no_such_command(profile_name=self.profile_name, session_name=self.session_info.name, cmd=self.params.cmd)
             return False
 
         if cmd in ("", None):
@@ -750,7 +755,8 @@ class X2goTerminalSessionSTDOUT(object):
 
         """
         if not self.has_command(_rewrite_cmd(self.params.cmd)):
-            self.client_instance.HOOK_no_such_command(profile_name=self.profile_name, session_name=self.session_info.name, cmd=self.params.cmd)
+            if self.client_instance:
+                self.client_instance.HOOK_no_such_command(profile_name=self.profile_name, session_name=self.session_info.name, cmd=self.params.cmd)
             return False
 
         setkbd = "0"
diff --git a/x2go/client.py b/x2go/client.py
index a0bf135..46d4fea 100644
--- a/x2go/client.py
+++ b/x2go/client.py
@@ -285,6 +285,8 @@ class X2goClient(object):
         self.logger('HOOK_printaction_error: incoming print job ,, %s'' caused error: %s' % (filename, err_msg), loglevel=log.loglevel_ERROR)
     def HOOK_on_control_session_death(self, profile_name):
         self.logger('HOOK_on_control_session_death: the control session of profile %s has died unexpectedly' % profile_name, loglevel=log.loglevel_WARN)
+    def HOOK_on_sound_tunnel_failed(self, profile_name='UNKNOWN', session_name='UNKNOWN'):
+        self.logger('HOOK_on_sound_tunnel_failed: setting up X2go sound for %s (%s) support failed' % (profile_name, session_name))
 
     def HOOK_on_session_has_started_by_me(self, session_uuid='UNKNOWN', profile_name='UNKNOWN', session_name='UNKNOWN'):
         self.logger('HOOK_on_session_has_started_by_me (session_uuid: %s, profile_name: %s): a new session %s has been started by this application' %  (session_uuid, profile_name, session_name), loglevel=log.loglevel_NOTICE)


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