[X2Go-Commits] python-x2go.git - release/0.4.0.x (branch) updated: 9ecbb8f58627e55cc39da03aaf33ba6a88e6c0e6

X2Go dev team git-admin at x2go.org
Tue Jan 7 16:16:14 CET 2014


The branch, release/0.4.0.x has been updated
       via  9ecbb8f58627e55cc39da03aaf33ba6a88e6c0e6 (commit)
      from  98bc65e33b9f0a92d8be038482c919d7d87819d5 (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 |   18 ++++++++++++++++++
 x2go/client.py                    |    2 ++
 2 files changed, 20 insertions(+)

The diff of changes is:
diff --git a/x2go/backends/terminal/_stdout.py b/x2go/backends/terminal/_stdout.py
index 7e1a1f4..e6b3553 100644
--- a/x2go/backends/terminal/_stdout.py
+++ b/x2go/backends/terminal/_stdout.py
@@ -633,6 +633,16 @@ class X2goTerminalSessionSTDOUT(object):
         (stdin, stdout, stderr) = self.control_session._x2go_exec_command(cmd_line)
         self.logger('x2gomountdirs output is : %s' % stdout.read().split('\n'), log.loglevel_NOTICE)
 
+    def has_command(self, cmd):
+        """\
+        Verify if the command <cmd> exists on the X2go server.
+
+        """
+        test_cmd = 'which %s && echo OK' % os.path.basename(cmd)
+        (stdin, stdout, stderr) = self.control_session._x2go_exec_command([test_cmd])
+        _stdout = stdout.read()
+        return _stdout.find('OK') != -1
+
     def run_command(self, cmd=None):
         """\
         Run a command in this session.
@@ -649,6 +659,10 @@ class X2goTerminalSessionSTDOUT(object):
         @rtype: tuple of str
 
         """
+        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)
+            return False
+
         if cmd in ("", None):
             if self.params.cmd is None:
                 cmd = 'TERMINAL'
@@ -729,6 +743,10 @@ class X2goTerminalSessionSTDOUT(object):
         that can be passed to the class constructor.
 
         """
+        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)
+            return False
+
         setkbd = "0"
         if self.params.kblayout or self.params.kbtype:
             setkbd = "1"
diff --git a/x2go/client.py b/x2go/client.py
index 29ff8f4..a0bf135 100644
--- a/x2go/client.py
+++ b/x2go/client.py
@@ -277,6 +277,8 @@ class X2goClient(object):
         self.logger('the Python X2go module could not find any usable XServer application, you will not be able to start X2go sessions without XServer', loglevel=log.loglevel_WARN)
     def HOOK_open_print_dialog(self, filename, profile_name='UNKNOWN', session_name='UNKNOWN'):
         self.logger('HOOK_open_print_dialog: incoming print job ,, %s'' detected by X2goClient hook method' % filename, loglevel=log.loglevel_WARN)
+    def HOOK_no_such_command(self, cmd, profile_name='UNKNOWN', session_name='UNKNOWN'):
+        self.logger('HOOK_no_such_command: the command %s is not available for X2go server (profile: %s, session: %s)' % (cmd, profile_name, session_name), loglevel=log.loglevel_WARN)
     def HOOK_open_dropbox_saveas_dialog(self, filename, profile_name='UNKNOWN', session_name='UNKNOWN'):
         self.logger('HOOK_open_dropbox_saveas_dialog: incoming dropbox job ,, %s'' detected by X2goClient hook method' % filename, loglevel=log.loglevel_WARN)
     def HOOK_printaction_error(self, filename, profile_name='UNKNOWN', session_name='UNKNOWN', err_msg='GENERIC_ERROR'):


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