The branch, twofactorauth has been updated via 83aac18e0c9d14234efcad2226bf7535bfe9c5a3 (commit) from fff4c5d721f7bb447a5da8f108730bdfc1627a91 (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 | 2 +- x2go/client.py | 55 ++++++++++++++++++++++++++++++------- x2go/registry.py | 22 ++++++++++++++- 3 files changed, 67 insertions(+), 12 deletions(-) The diff of changes is: diff --git a/x2go/backends/terminal/_stdout.py b/x2go/backends/terminal/_stdout.py index 963345e..10bd484 100644 --- a/x2go/backends/terminal/_stdout.py +++ b/x2go/backends/terminal/_stdout.py @@ -557,7 +557,7 @@ 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_INFO) + self.logger('x2gomountdirs output is : %s' % stdout.read().split('\n'), log.loglevel_NOTICE) def run_command(self, cmd=None): """\ diff --git a/x2go/client.py b/x2go/client.py index ef3e1e5..1d5d659 100644 --- a/x2go/client.py +++ b/x2go/client.py @@ -259,6 +259,7 @@ class X2goClient(object): # presume the running XServer listens on :0 os.environ.update({'DISPLAY': 'localhost:0'}) + self.auto_register_sessions = auto_register_sessions self.session_registry = X2goSessionRegistry(self, logger=self.logger) self.session_guardian = X2goSessionGuardian(self, auto_update_listsessions_cache=auto_update_listsessions_cache & use_listsessions_cache, auto_update_sessionregistry=auto_update_sessionregistry, @@ -665,11 +666,13 @@ class X2goClient(object): @rtype: C{bool} """ - return self.session_registry(session_uuid).connect(username=username, password=password, - sshproxy_user=sshproxy_user, sshproxy_password=sshproxy_password, - add_to_known_hosts=add_to_known_hosts, - force_password_auth=force_password_auth, - ) + _success = self.session_registry(session_uuid).connect(username=username, password=password, + sshproxy_user=sshproxy_user, sshproxy_password=sshproxy_password, + add_to_known_hosts=add_to_known_hosts, + force_password_auth=force_password_auth, + ) + if self.auto_register_sessions: + self.session_registry.register_available_server_sessions(profile_name=self.get_session_profile_name(session_uuid)) __connect_session = connect_session def disconnect_session(self, session_uuid): @@ -970,7 +973,7 @@ 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 share_local_folder_with_session(self, session_uuid, folder_name): + def share_local_folder_with_session(self, session_uuid=None, folder_name=_LOCAL_HOME, profile_name=None): """\ Share a local folder with the X2go session registered as C{session_uuid}. @@ -988,7 +991,15 @@ class X2goClient(object): @rtype: C{bool} """ - return self.session_registry(session_uuid).share_local_folder(folder_name=folder_name) + if session_uuid is None and profile_name: + _associated = self._X2goClient__client_associated_sessions_of_profile_name(profile_name, return_objects=False) + if len(_associated) > 0: + session_uuid = _associated[0] + if session_uuid: + return self.session_registry(session_uuid).share_local_folder(folder_name=folder_name) + else: + self.logger('Cannot find a terminal session for profile ,,%s\'\' to share a local folder with' % profile_name, loglevel=log.loglevel_WARN) + return False __share_local_folder_with_session = share_local_folder_with_session ### @@ -1012,6 +1023,23 @@ class X2goClient(object): return self.session_registry.has_connected_sessions __client_has_connected_sessions = client_has_connected_sessions + def client_associated_sessions(self, return_objects=False, return_profile_names=False): + """\ + STILL UNDOCUMENTED + + """ + return self.session_registry.associated_sessions(return_objects=return_objects, return_profile_names=return_profile_names) + __client_associated_sessions = client_associated_sessions + + @property + def client_has_associated_sessions(self): + """\ + STILL UNDOCUMENTED + + """ + return self.session_registry.has_associated_sessions + __client_has_associated_sessions = client_has_associated_sessions + def client_running_sessions(self, return_objects=False, return_profile_names=False): """\ STILL UNDOCUMENTED @@ -1102,7 +1130,15 @@ class X2goClient(object): """ return self.session_registry.connected_sessions_of_profile_name(profile_name, return_objects=return_objects) - __client_connected_sessions = client_connected_sessions + __client_connected_sessions_of_profile_name = client_connected_sessions_of_profile_name + + def client_associated_sessions_of_profile_name(self, profile_name, return_objects=False): + """\ + STILL UNDOCUMENTED + + """ + return self.session_registry.associated_sessions_of_profile_name(profile_name, return_objects=return_objects) + __client_associated_sessions_of_profile_name = client_associated_sessions_of_profile_name ### ### Provide access to the X2go server's sessions DB @@ -1276,8 +1312,7 @@ class X2goClient(object): if register_sessions: self.session_registry.register_available_server_sessions(profile_name=self.get_session_profile_name(session_uuid), - session_list=_session_list, - update_sessionregistry=False) + session_list=_session_list) return _session_list __list_sessions = list_sessions diff --git a/x2go/registry.py b/x2go/registry.py index fd40b39..ac600e3 100644 --- a/x2go/registry.py +++ b/x2go/registry.py @@ -370,7 +370,10 @@ class X2goSessionRegistry(object): raise X2goSessionException('no session of name ,,%s\'\' registered' % session_name) def _sessionsWithState(self, state, return_objects=True, return_profile_names=False, return_profile_ids=False): - sessions = [ ts for ts in self.registry.values() if eval('ts.%s' % state) ] + if state == 'associated': + sessions = [ ts for ts in self.registry.values() if ts.has_terminal_session() ] + else: + sessions = [ ts for ts in self.registry.values() if eval('ts.%s' % state) ] if return_profile_names: profile_names = [] for session in sessions: @@ -395,6 +398,13 @@ class X2goSessionRegistry(object): """ return self._sessionsWithState('connected', return_objects=return_objects, return_profile_names=return_profile_names, return_profile_ids=return_profile_ids) + def associated_sessions(self, return_objects=True, return_profile_names=False, return_profile_ids=False): + """\ + STILL UNDOCUMENTED + + """ + return self._sessionsWithState('associated', return_objects=return_objects, return_profile_names=return_profile_names, return_profile_ids=return_profile_ids) + def virgin_sessions(self, return_objects=True, return_profile_names=False, return_profile_ids=False): """\ STILL UNDOCUMENTED @@ -473,6 +483,16 @@ class X2goSessionRegistry(object): else: return self.connected_sessions() and [ s.get_uuid() for s in self.connected_sessions() if s.profile_name == profile_name ] + def associated_sessions_of_profile_name(self, profile_name, return_objects=False): + """\ + STILL UNDOCUMENTED + + """ + if return_objects: + return self.associated_sessions() and [ s for s in self.associated_sessions() if s.profile_name == profile_name ] + else: + return self.associated_sessions() and [ s.get_uuid() for s in self.associated_sessions() if s.profile_name == profile_name ] + def registered_sessions_of_profile_name(self, profile_name, return_objects=False): """\ STILL UNDOCUMENTED 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).