[X2Go-Commits] python-x2go.git - build-baikal (branch) updated: d2fa372a6f7988a4743b8e683e759354bcf2dde1
X2Go dev team
git-admin at x2go.org
Wed Jan 8 15:27:15 CET 2014
The branch, build-baikal has been updated
via d2fa372a6f7988a4743b8e683e759354bcf2dde1 (commit)
from db9631eda589d695f31735ee31adb421cf0f0211 (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/profiles.py | 15 +++++++++---
x2go/registry.py | 67 ++++++++++++++++++++++++++++++++----------------------
2 files changed, 52 insertions(+), 30 deletions(-)
The diff of changes is:
diff --git a/x2go/profiles.py b/x2go/profiles.py
index 22e4f18..00ae796 100644
--- a/x2go/profiles.py
+++ b/x2go/profiles.py
@@ -50,7 +50,7 @@ class X2goSessionProfiles(inifiles.X2goIniFile):
self.logger = copy.deepcopy(logger)
self.logger.tag = __NAME__
- # providing defaults for an X2goSessionProfiles instance will---in the worst case---override your
+ # providing defaults for an X2goSessionProfiles instance will---in the worst case---override your
# existing sessions file in your home directory once you write the sessions back to file...
inifiles.X2goIniFile.__init__(self, config_files, defaults=defaults, logger=logger, loglevel=loglevel)
@@ -180,10 +180,19 @@ class X2goSessionProfiles(inifiles.X2goIniFile):
def get_default_profile(self):
"""\
- STILL UNDOCUMENTED
+ Finds the default profile that can be used for making a connection.
+ If there is only one profile that profile is automatically the default
+ profile
+ STILL UNDOCUMENTED
"""
- return '...'
+ idx = -1
+ for idx, profile_name in enumerate(self.profile_names):
+ checkProfile = self.get_profile_config(profile_name)
+ if checkProfile['default']:
+ return checkProfile
+ if idx == 0:
+ return checkProfile
def check_profile_id_or_name(self, profile_id_or_name):
"""\
diff --git a/x2go/registry.py b/x2go/registry.py
index 672bcba..e541ba4 100644
--- a/x2go/registry.py
+++ b/x2go/registry.py
@@ -57,7 +57,7 @@ class X2goRegisteredSession(object):
def __get_username(self):
"""\
- After a session has been setup up you can query the
+ After a session has been setup up you can query the
username the sessions runs as.
@return: the remote username the X2go session runs as
@@ -69,12 +69,12 @@ class X2goRegisteredSession(object):
def __get_server(self):
"""\
- After a session has been setup up you can query the
- hostname of the host the sessions is connected to (or
+ After a session has been setup up you can query the
+ hostname of the host the sessions is connected to (or
about to connect to).
- @return: the hostname of the server the X2go session is
- connected to (as an C{(addr,port)} tuple)
+ @return: the hostname of the server the X2go session is
+ connected to (as an C{(addr,port)} tuple)
@rtype: tuple
"""
@@ -95,15 +95,15 @@ class X2goRegisteredSession(object):
def __connect(self, password=None, add_to_known_hosts=False, force_password_auth=False):
"""\
- Connect to a registered X2go session with registry hash C{<session_uuid>}.
- This method basically wraps around paramiko.SSHClient.connect() for the
+ Connect to a registered X2go session with registry hash C{<session_uuid>}.
+ This method basically wraps around paramiko.SSHClient.connect() for the
corresponding session.
- @param password: the user's password for the X2go server that is going to be
+ @param password: the user's password for the X2go server that is going to be
connected to
@type password: str
- @param add_to_known_hosts: non-paramiko option, if C{True} paramiko.AutoAddPolicy()
- is used as missing-host-key-policy. If set to C{False} paramiko.RejectPolicy()
+ @param add_to_known_hosts: non-paramiko option, if C{True} paramiko.AutoAddPolicy()
+ is used as missing-host-key-policy. If set to C{False} paramiko.RejectPolicy()
is used
@type add_to_known_hosts: bool
@param force_password_auth: disable SSH pub/priv key authentication mechanisms
@@ -155,7 +155,7 @@ class X2goRegisteredSession(object):
def __resume(self, session_name):
"""\
- Resume or continue a suspended / running X2go session on the
+ Resume or continue a suspended / running X2go session on the
remote X2go server.
@param session_name: the server-side name of an X2go session
@@ -177,13 +177,13 @@ class X2goRegisteredSession(object):
def __suspend(self):
"""\
- Suspend an X2go session.
+ Suspend an X2go session.
- You can either suspend a session that you have formerly
+ You can either suspend a session that you have formerly
started/resumed the current X2goClient instance.
Or you can suspend a non-attached session by simply
- registering an X2go server session and then passing the
+ registering an X2go server session and then passing the
server-side X2go session name to this method.
"""
@@ -194,13 +194,13 @@ class X2goRegisteredSession(object):
def __terminate(self):
"""\
- Terminate an X2go session.
+ Terminate an X2go session.
- You can either terminate a session that you have formerly
+ You can either terminate a session that you have formerly
started/resumed within the current X2goClient instance.
Or you can terminate a non-attached session by simply
- registering an X2go server session and then passing the
+ registering an X2go server session and then passing the
server-side X2go session name to this method.
"""
@@ -246,7 +246,7 @@ class X2goRegisteredSession(object):
###
def __session_ok(self):
- """\
+ """\
Test if the X2go session registered as C{session_uuid} is
in a healthy state.
@@ -262,7 +262,7 @@ class X2goRegisteredSession(object):
def __is_running(self):
"""\
- Test if the X2go session registered as C{session_uuid} is up
+ Test if the X2go session registered as C{session_uuid} is up
and running.
@return: C{True} if session is running, C{False} otherwise
@@ -274,7 +274,7 @@ class X2goRegisteredSession(object):
def __is_suspended(self):
"""\
- Test if the X2go session registered as C{session_uuid}
+ Test if the X2go session registered as C{session_uuid}
is in suspended state.
@return: C{True} if session is suspended, C{False} otherwise
@@ -286,7 +286,7 @@ class X2goRegisteredSession(object):
def __has_terminated(self):
"""\
- Test if the X2go session registered as C{session_uuid}
+ Test if the X2go session registered as C{session_uuid}
has terminated.
@return: C{True} if session has terminated, C{False} otherwise
@@ -300,11 +300,11 @@ class X2goRegisteredSession(object):
"""\
Share a local folder with the X2go session registered as C{session_uuid}.
- @param folder_name: the full path to an existing folder on the local
+ @param folder_name: the full path to an existing folder on the local
file system
@type folder_name: str
- @return: returns C{True} if the local folder has been successfully mounted within the
+ @return: returns C{True} if the local folder has been successfully mounted within the
X2go server session registerd as UUID C{session_uuid}
@rtype: bool
@@ -413,7 +413,7 @@ class X2goSessionRegistry(object):
STILL UNDOCUMENTED
"""
- self._sessionsWithState(self, 'connected')
+ self._sessionsWithState('connected')
@property
def running_sessions(self):
@@ -421,7 +421,7 @@ class X2goSessionRegistry(object):
STILL UNDOCUMENTED
"""
- self._sessionsWithState(self, 'running')
+ self._sessionsWithState('running')
@property
def suspended_sessions(self):
@@ -429,7 +429,7 @@ class X2goSessionRegistry(object):
STILL UNDOCUMENTED
"""
- self._sessionsWithState(self, 'suspended')
+ self._sessionsWithState('suspended')
@property
def terminated_sessions(self):
@@ -437,7 +437,7 @@ class X2goSessionRegistry(object):
STILL UNDOCUMENTED
"""
- self._sessionsWithState(self, 'terminated')
+ self._sessionsWithState('terminated')
@property
def has_running_session(self):
@@ -463,3 +463,16 @@ class X2goSessionRegistry(object):
"""
return [ s for s in self.registry.values() if s not in self.running_sessions ]
+ def running_sessions_of_name(self, profile_name):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ return [ s for s in self.running_sessions if s.profile_name == profile_name ]
+
+ def suspended_sessions_of_name(self, profile_name):
+ """\
+ STILL UNDOCUMENTED
+
+ """
+ return [ s for s in self.running_sessions if s.profile_name == profile_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