[X2Go-Commits] [x2goclient] 14/94: * PyHoca-CLI adaptations to changes in Python X2go API
git-admin at x2go.org
git-admin at x2go.org
Fri Dec 15 21:04:32 CET 2023
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to annotated tag 0.1.4.0
in repository x2goclient.
commit 8ca39e2e112dada0bbd23b9e1759be7b8c9049cc
Author: mike <mike at cdb5e8f1-f799-4276-8919-bce57fd91830>
Date: Tue Nov 9 22:01:18 2010 +0000
* PyHoca-CLI adaptations to changes in Python X2go API
git-svn-id: https://svn.das-netzwerkteam.de/x2go/pyhoca-cli/trunk@43 cdb5e8f1-f799-4276-8919-bce57fd91830
---
pyhoca/cli/frontend.py | 37 ++++++++++++++++++++++---------------
1 file changed, 22 insertions(+), 15 deletions(-)
diff --git a/pyhoca/cli/frontend.py b/pyhoca/cli/frontend.py
index 5e4459c5..5aae849e 100644
--- a/pyhoca/cli/frontend.py
+++ b/pyhoca/cli/frontend.py
@@ -80,8 +80,8 @@ class PyHocaCLI(x2go.X2goClient):
print
print "Available runing/suspended X2go sessions"
print "========================================"
- print "Host: [%s]:%s" % self.get_server(s_hash)
- print "Username: %s" % self.get_username(s_hash)
+ print "Host: [%s]:%s" % self._X2goClient__get_session_server(s_hash)
+ print "Username: %s" % self._X2goClient__get_session_username(s_hash)
print
session_infos = self._X2goClient__list_sessions(s_hash)
for session_info in session_infos.values():
@@ -107,9 +107,10 @@ class PyHocaCLI(x2go.X2goClient):
print
print "Available X2go session profiles"
print "==============================="
- for _profile_id in self.get_session_profile_ids():
- _profile_config = self.get_session_profile_config(_profile_id)
- _session_params = self.get_session_profile_params(_profile_id)
+ _profiles = self._X2goClient__get_profiles()
+ for _profile_id in _profiles.profile_ids:
+ _profile_config = _profiles.get_profile_config(_profile_id)
+ _session_params = _profiles.to_session_params(_profile_id)
print _profile_config
print _session_params
print
@@ -118,8 +119,13 @@ class PyHocaCLI(x2go.X2goClient):
"""\
STILL UNDOCUMENTED
"""
+ _profiles = self._X2goClient__get_profiles()
+ if self.args.session_profile and _profiles.has_profile(self.args.session_profile):
+ _server = _profiles.get_session_param(self.args.session_profile, 'server')
+ else:
+ _server = self.args.server
# clean all sessions from X2go server
- self.logger('cleaning up all running sessions from X2go server: %s' % self.args.server, x2go.loglevel_NOTICE, )
+ self.logger('cleaning up all running sessions from X2go server: %s' % _server, x2go.loglevel_NOTICE, )
self._X2goClient__clean_sessions(s_hash)
@@ -191,8 +197,8 @@ class PyHocaCLI(x2go.X2goClient):
x2go.X2goClient.__init__(self, logger=liblogger)
- _session_profiles = self._X2goClient__get_session_profiles()
- if self.args.session_profile and _session_profiles.has_profile(self.args.session_profile):
+ _profiles = self._X2goClient__get_profiles()
+ if self.args.session_profile and _profiles.has_profile(self.args.session_profile):
self.x2go_session_hash = self._X2goClient__register_session(profile_name=self.args.session_profile)
@@ -229,7 +235,7 @@ class PyHocaCLI(x2go.X2goClient):
force_password_auth = False
while not connected:
try:
- self.connect_session(self.x2go_session_hash, password=self.args.password, force_password_auth=force_password_auth)
+ self._X2goClient__connect_session(self.x2go_session_hash, password=self.args.password, force_password_auth=force_password_auth)
connected = True
except x2go.AuthenticationException:
force_password_auth = True
@@ -245,6 +251,7 @@ class PyHocaCLI(x2go.X2goClient):
def MainLoop(self):
"""\
STILL UNDOCUMENTED
+
"""
if self.args.clean_sessions:
self.clean_sessions(self.x2go_session_hash)
@@ -284,10 +291,10 @@ class PyHocaCLI(x2go.X2goClient):
time.sleep(1)
i+=1
- if self.session_ok(self.x2go_session_hash):
+ if self._X2goClient__session_ok(self.x2go_session_hash):
- profile_name = self.get_profile_name(self.x2go_session_hash)
- session_name = self.get_session_name(self.x2go_session_hash)
+ profile_name = self._X2goClient__get_session_profile_name(self.x2go_session_hash)
+ session_name = self._X2goClient__get_session_name(self.x2go_session_hash)
self.logger("X2go session is now running, the X2go client's profile name is: %s" % profile_name, x2go.loglevel_INFO, )
self.logger("X2go session name is: %s" % session_name, x2go.loglevel_INFO, )
self.logger("Press CTRL+C to suspend the running session...", x2go.loglevel_NOTICE, )
@@ -302,11 +309,11 @@ class PyHocaCLI(x2go.X2goClient):
# wait a little longer before telling the user what had happened
time.sleep(2)
- if self._X2goClient__has_terminated(self.x2go_session_hash):
+ if self._X2goClient__has_session_terminated(self.x2go_session_hash):
self.logger("X2go session %s has terminated" % session_name, x2go.loglevel_NOTICE, )
- elif self._X2goClient__is_suspended(self.x2go_session_hash):
+ elif self._X2goClient__is_session_suspended(self.x2go_session_hash):
self.logger("X2go session %s has been suspended" % session_name, x2go.loglevel_NOTICE, )
- elif self._X2goClient__is_running(self.x2go_session_hash):
+ elif self._X2goClient__is_session_running(self.x2go_session_hash):
self.logger("X2go session %s has been moved to a different screen" % session_name, x2go.loglevel_NOTICE, )
except KeyboardInterrupt:
--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
More information about the x2go-commits
mailing list