The branch, twofactorauth has been updated via 84683b883de5c853506c116d715f8c054de4a2bf (commit) from 5aa1c6f22f593c1efb58c1f0342746f5772ea540 (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 | 2 ++ x2go/client.py | 48 ++++++++++++++++++++++++++++++++++++++ x2go/session.py | 68 ++++++++++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 109 insertions(+), 9 deletions(-) The diff of changes is: diff --git a/debian/changelog b/debian/changelog index b74c497..f60caf1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -25,6 +25,8 @@ python-x2go (0.1.2.0-0~x2go1) UNRELEASED; urgency=low - Fix X2Go desktop sharing support. - New feature, allow/fix sessions on localhost system. - Tolerate names containing "-" characters. + - Provide hook methods for SSHFS failures (local folder sharing, printing, + MIME box). * Depend on python-xlib. -- Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Sat, 28 Sep 2012 01:44:21 +0100 diff --git a/x2go/client.py b/x2go/client.py index 880c79d..85481fb 100644 --- a/x2go/client.py +++ b/x2go/client.py @@ -595,6 +595,54 @@ class X2goClient(object): """ self.logger('HOOK_on_session_has_terminated (session_uuid: %s, profile_name: %s): session %s has terminated' % (session_uuid, profile_name, session_name), loglevel=log.loglevel_NOTICE) + def HOOK_printing_not_available(self, profile_name='UNKNOWN', session_name='UNKNOWN'): + """\ + HOOK method: called if X2Go client-side printing is not available. + + @param profile_name: profile name of session that called this hook method + @type profile_name: C{str} + @param session_name: X2Go session name + @type session_name: C{str} + + """ + self.logger('HOOK_foldersharing_not_available: X2Go\'s client-side printing feature is not available with this session (%s) of profile %s.' % (session_name, profile_name), loglevel=log.loglevel_WARN) + + def HOOK_mimebox_not_available(self, profile_name='UNKNOWN', session_name='UNKNOWN'): + """\ + HOOK method: called if the X2Go MIME box is not available. + + @param profile_name: profile name of session that called this hook method + @type profile_name: C{str} + @param session_name: X2Go session name + @type session_name: C{str} + + """ + self.logger('HOOK_mimebox_not_available: X2Go\'s MIME box feature is not available with this session (%s) of profile %s.' % (session_name, profile_name), loglevel=log.loglevel_WARN) + + def HOOK_foldersharing_not_available(self, profile_name='UNKNOWN', session_name='UNKNOWN'): + """\ + HOOK method: called if X2Go client-side folder-sharing is not available. + + @param profile_name: profile name of session that called this hook method + @type profile_name: C{str} + @param session_name: X2Go session name + @type session_name: C{str} + + """ + self.logger('HOOK_foldersharing_not_available: X2Go\'s client-side folder sharing feature is not available with this session (%s) of profile %s.' % (session_name, profile_name), loglevel=log.loglevel_WARN) + + def HOOK_sshfs_not_available(self, profile_name='UNKNOWN', session_name='UNKNOWN'): + """\ + HOOK method: called if the X2Go server denies SSHFS access. + + @param profile_name: profile name of session that called this hook method + @type profile_name: C{str} + @param session_name: X2Go session name + @type session_name: C{str} + + """ + self.logger('HOOK_sshfs_not_available: the remote X2Go server (%s) denies SSHFS access for session %s. This will result in client-side folder sharing, printing and the MIME box feature being unavailable' % (session_name, profile_name), loglevel=log.loglevel_WARN) + def _detect_backend_classes(self): # CONTROL session backend if type(self.control_backend) is types.StringType: diff --git a/x2go/session.py b/x2go/session.py index 5d58b63..c4b71b5 100644 --- a/x2go/session.py +++ b/x2go/session.py @@ -324,6 +324,46 @@ class X2goSession(object): # get rid of the faulty session... self.terminate() + def HOOK_printing_not_available(self): + """\ + HOOK method: called if X2Go client-side printing is not available. + + """ + if self.client_instance: + self.client_instance.HOOK_printing_not_available(profile_name=self.profile_name, session_name=self.session_name) + else: + self.logger('HOOK_foldersharing_not_available: X2Go\'s client-side printing feature is not available with this session (%s) of profile %s.' % (self.session_name, self.profile_name), loglevel=log.loglevel_WARN) + + def HOOK_mimebox_not_available(self): + """\ + HOOK method: called if the X2Go MIME box is not available. + + """ + if self.client_instance: + self.client_instance.HOOK_mimebox_not_available(profile_name=self.profile_name, session_name=self.session_name) + else: + self.logger('HOOK_mimebox_not_available: X2Go\'s MIME box feature is not available with this session (%s) of profile %s.' % (self.session_name, self.profile_name), loglevel=log.loglevel_WARN) + + def HOOK_foldersharing_not_available(self): + """\ + HOOK method: called if X2Go client-side folder-sharing is not available. + + """ + if self.client_instance: + self.client_instance.HOOK_foldersharing_not_available(profile_name=self.profile_name, session_name=self.session_name) + else: + self.logger('HOOK_foldersharing_not_available: X2Go\'s client-side folder sharing feature is not available with this session (%s) of profile %s.' % (self.session_name, self.profile_name), loglevel=log.loglevel_WARN) + + def HOOK_sshfs_not_available(self): + """\ + HOOK method: called if the X2Go server denies SSHFS access. + + """ + if self.client_instance: + self.client_instance.HOOK_foldersharing_not_available(profile_name=self.profile_name, session_name=self.session_name) + else: + self.logger('HOOK_sshfs_not_available: the remote X2Go server (%s) denies SSHFS access for session %s. This will result in client-side folder sharing, printing and the MIME box feature being unavailable' % (self.profile_name, self.session_name), loglevel=log.loglevel_WARN) + def HOOK_check_host_dialog(self, host, port, fingerprint='no fingerprint', fingerprint_type='RSA'): """\ HOOK method: called if a host check is requested. This hook has to either return C{True} (default) or C{False}. @@ -1164,7 +1204,7 @@ class X2goSession(object): self.terminal_session and not self.faulty and self.terminal_session.start_sshfs() except x2go_exceptions.X2goUserException, e: self.logger('%s' % str(e), loglevel=log.loglevel_WARN) - # TODO: handle this exception as a notification hook method... + self.HOOK_sshfs_not_available() self._SUPPORTED_PRINTING = False self._SUPPORTED_MIMEBOX = False self._SUPPORTED_FOLDERSHARING = False @@ -1175,17 +1215,27 @@ class X2goSession(object): self.terminal_session and not self.faulty and self.session_environment.update({'X2GO_SPOOLDIR': self.terminal_session.get_printing_spooldir(), }) except x2go_exceptions.X2goUserException, e: self.logger('%s' % str(e), loglevel=log.loglevel_WARN) - # TODO: handle this exception as a notification hook method... + self.HOOK_printing_not_available() self._SUPPORTED_PRINTING = False - if self._SUPPORTED_MIMEBOX and self.allow_mimebox: - self.terminal_session and not self.faulty and self.terminal_session.start_mimebox(mimebox_extensions=self.mimebox_extensions, mimebox_action=self.mimebox_action) - self.terminal_session and self.session_environment.update({'X2GO_MIMEBOX': self.terminal_session.get_mimebox_spooldir(), }) + try: + if self._SUPPORTED_MIMEBOX and self.allow_mimebox: + self.terminal_session and not self.faulty and self.terminal_session.start_mimebox(mimebox_extensions=self.mimebox_extensions, mimebox_action=self.mimebox_action) + self.terminal_session and self.session_environment.update({'X2GO_MIMEBOX': self.terminal_session.get_mimebox_spooldir(), }) + except x2go_exceptions.X2goUserException, e: + self.logger('%s' % str(e), loglevel=log.loglevel_WARN) + self.HOOK_mimebox_not_available() + self._SUPPORTED_MIMEBOX = False - if self.share_local_folders and self.terminal_session and not self.faulty and self.is_folder_sharing_available(): - if _control.get_transport().reverse_tunnels[self.terminal_session.get_session_name()]['sshfs'][1] is not None: - for _folder in self.share_local_folders: - self.share_local_folder(_folder) + try: + if self.share_local_folders and self.terminal_session and not self.faulty and self.is_folder_sharing_available(): + if _control.get_transport().reverse_tunnels[self.terminal_session.get_session_name()]['sshfs'][1] is not None: + for _folder in self.share_local_folders: + self.share_local_folder(_folder) + except x2go_exceptions.X2goUserException, e: + self.logger('%s' % str(e), loglevel=log.loglevel_WARN) + self.HOOK_foldersharing_not_available() + self._SUPPORTED_FOLDERSHARING = False self.virgin = False self.suspended = False 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).