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 03caa0afa80125287c2a305fd7596e8d646eb118 Author: mike <mike@cdb5e8f1-f799-4276-8919-bce57fd91830> Date: Sun Nov 7 01:00:35 2010 +0000 * added --list-profiles option to PyHoca CLI git-svn-id: https://svn.das-netzwerkteam.de/x2go/pyhoca-cli/trunk@32 cdb5e8f1-f799-4276-8919-bce57fd91830 --- pyhoca-cli | 37 +++++++++++++++++++++++++++++-------- pyhoca/cli/frontend.py | 16 ++++++++++++++++ 2 files changed, 45 insertions(+), 8 deletions(-) diff --git a/pyhoca-cli b/pyhoca-cli index aedcdaa4..0aac277d 100755 --- a/pyhoca-cli +++ b/pyhoca-cli @@ -76,6 +76,7 @@ action_options = [ {'args':['-S','--suspend'], 'default': None, 'metavar': 'SESSION_NAME', 'help': 'suspend running X2go session SESSION_NAME', }, {'args':['-T','--terminate'], 'default': None, 'metavar': 'SESSION_NAME', 'help': 'terminate running X2go session SESSION_NAME', }, {'args':['-L','--list-sessions'], 'default': False, 'action': 'store_true', 'help': 'list user\'s X2go sessions on server', }, + {'args':['-l','--list-profiles'], 'default': False, 'action': 'store_true', 'help': 'list user\'s X2go pre-configured session profiles', }, {'args':['-P','--session-profile'], 'default': None, 'help': 'load x2goclient session profiles and use the session profile SESSION_PROFILE', }, ] # debug options... @@ -187,7 +188,7 @@ Possible values for the --pack NX option are: except ValueError: runtime_error("--time_to_wait value needs to be an integer value", parser=p, exitcode=80) - if not a.session_profile: + if not (a.session_profile or a.list_profiles): # the --server options is required for most operations if not a.server: @@ -204,7 +205,7 @@ Possible values for the --pack NX option are: runtime_error("unknown pack method '%s'" % args.pack, parser=p, exitcode=10) else: - if not (a.resume or a.suspend or a.terminate or a.list_sessions): + if not (a.resume or a.suspend or a.terminate or a.list_sessions or a.list_profiles): a.new = True # X2go printing @@ -299,14 +300,34 @@ if __name__ == '__main__': # parse command line parser, args = parseargs() - # initialize the X2GoClient context and start the connection to the X2go server - logger('preparing requested X2go session', x2go.loglevel_NOTICE, ) - try: - thisPyHocaCLI = PyHocaCLI(args, logger=logger, liblogger=liblogger) - thisPyHocaCLI.authenticate() - thisPyHocaCLI.MainLoop() + if args.list_profiles: + + _session_profiles = x2go.X2goSessionProfiles() + # retrieve a session list + print + print "Available X2go session profiles" + print "===============================" + print "configuration files: %s" % _session_profiles.config_files + print "user configuration file: %s" % _session_profiles.user_config_file + print + for _profile_id in _session_profiles.profile_ids: + _profile_config = _session_profiles.get_profile_config(_profile_id) + _session_params = _session_profiles.to_session_params(_profile_id) + print 'Profile ID: %s' % _profile_id + print 'Profile Name: %s' % _session_params['profile_name'] + pprint.pprint(_session_params) + print + + else: + + # initialize the X2GoClient context and start the connection to the X2go server + logger('preparing requested X2go session', x2go.loglevel_NOTICE, ) + + thisPyHocaCLI = PyHocaCLI(args, logger=logger, liblogger=liblogger) + thisPyHocaCLI.authenticate() + thisPyHocaCLI.MainLoop() sys.exit(0) diff --git a/pyhoca/cli/frontend.py b/pyhoca/cli/frontend.py index 5546e41a..7401ec8b 100644 --- a/pyhoca/cli/frontend.py +++ b/pyhoca/cli/frontend.py @@ -102,6 +102,17 @@ class PyHocaCLI(x2go.X2goClient): print "suspended since: %s" % session_info.date_suspended print + def list_profiles(self): + # retrieve a session list + 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) + print _profile_config + print _session_params + print def clean_sessions(self, s_hash): """\ @@ -243,6 +254,11 @@ class PyHocaCLI(x2go.X2goClient): self.list_sessions(self.x2go_session_hash) sys.exit(0) + if self.args.list_profiles: + # print a beautified profile list for the user + self.list_profiles() + sys.exit(0) + if self.args.resume: self.resume_session(self.x2go_session_hash) -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goclient.git