This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository pyhoca-cli.
commit e2dedb1ce4f755197167cb350379d7c961683762 Author: Mike Gabriel <mike.gabr...@das-netzwerkteam.de> Date: Sat May 12 22:46:30 2018 +0200 Add --try-resume cmd line option and feature. Bump version to 0.5.99.1. --- debian/changelog | 7 ++++--- debian/control | 2 +- man/man1/pyhoca-cli.1 | 5 ++++- pyhoca-cli | 2 +- pyhoca-cli.spec | 4 ++-- pyhoca/cli/__init__.py | 2 +- pyhoca/cli/frontend.py | 27 ++++++++++++++++++++++++++- 7 files changed, 39 insertions(+), 10 deletions(-) diff --git a/debian/changelog b/debian/changelog index 37dfb7c..619ded8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,10 @@ -pyhoca-cli (0.5.99.0-0x2go1) UNRELEASED; urgency=medium +pyhoca-cli (0.5.99.1-0x2go1) UNRELEASED; urgency=medium - * New upstream version (0.5.99.0). + * New upstream version (0.5.99.1). - Port to Python3. - Add --force-password command line switch to override SSH key detection code. + - Add --try-resume cmd line option and feature. * debian/rules: + Build for Python3, not Python2. + Enforce Python3 build, fix FTBFS. @@ -16,7 +17,7 @@ pyhoca-cli (0.5.99.0-0x2go1) UNRELEASED; urgency=medium + Switch to pybuild DH build system. * debian/{control,compat}: Bump to DH version level 9. - -- Mike Gabriel <mike.gabr...@das-netzwerkteam.de> Fri, 22 Sep 2017 14:09:18 +0200 + -- Mike Gabriel <mike.gabr...@das-netzwerkteam.de> Sat, 12 May 2018 20:37:21 +0000 pyhoca-cli (0.5.0.4-0x2go1) unstable; urgency=medium diff --git a/debian/control b/debian/control index 2175179..3e54925 100644 --- a/debian/control +++ b/debian/control @@ -23,7 +23,7 @@ Depends: ${misc:Depends}, ${python3:Depends}, python3, - python3-x2go (>=0.5.99.0-0~), + python3-x2go (>=0.5.99.1-0~), python3-argparse, python3-setproctitle, Suggests: diff --git a/man/man1/pyhoca-cli.1 b/man/man1/pyhoca-cli.1 index c1c575d..750b5f7 100644 --- a/man/man1/pyhoca-cli.1 +++ b/man/man1/pyhoca-cli.1 @@ -5,7 +5,7 @@ \\$2 \(la\\$1\(ra\\$3 .. .if \n(.g .mso www.tmac -.TH pyhoca-cli 1 "Sep 2017" "Version 0.5.0.5" "X2Go Application" +.TH pyhoca-cli 1 "Sep 2017" "Version 0.5.99.1" "X2Go Application" .SH NAME pyhoca-cli \- X2Go command line client written in Python .SH SYNOPSIS @@ -70,6 +70,9 @@ The name of the session profile to be used to make the connection. \*(T<\fB\-N, \-\-new\fR\*(T> Start a new X2Go session on server (default mode if no mode is explicitly specified). .TP +\*(T<\fB\-\-try\-resume\fR\*(T> +When given with \fI\-\-new\fR , try finding and resuming a session originally started with the same command. If that fails, start a new session, finally. +.TP \*(T<\fB\-R, \-\-resume\fR \fI<SESSION_NAME>\fR\*(T> Resume existing X2Go session <SESSION_NAME> on server. Special values for <SESSION_NAME> are ,,NEWEST'' (will resume youngest session) or ,,OLDEST'' (resume session with oldest timestamp). diff --git a/pyhoca-cli b/pyhoca-cli index 24913f5..1df4cac 100755 --- a/pyhoca-cli +++ b/pyhoca-cli @@ -128,6 +128,7 @@ liblogger = x2go.X2GoLogger() # exclusive client control options action_options = [ {'args':['-N','--new'], 'default': False, 'action': 'store_true', 'help': 'start a new X2Go session on server (default)', }, + {'args':['--try-resume'], 'default': False, 'action': 'store_true', 'help': 'if given with --new, try to resume a running/suspended session, otherwise start a new session', }, {'args':['-R','--resume'], 'default': None, 'metavar': 'SESSION_NAME', 'help': 'resume a suspended X2Go session with name SESSION_NAME', }, {'args':['-D','--share-desktop'], 'default': None, 'metavar': 'USER@DISPLAY', 'help': 'share an X2Go session on server specified by USER@DISPLAY', }, {'args':['-S','--suspend'], 'default': None, 'metavar': 'SESSION_NAME', 'help': 'suspend running X2Go session SESSION_NAME', }, @@ -427,4 +428,3 @@ if __name__ == '__main__': except (KeyboardInterrupt, SystemExit) as e: x2go.x2go_cleanup(e) - diff --git a/pyhoca-cli.spec b/pyhoca-cli.spec index 2d86093..4e4425d 100644 --- a/pyhoca-cli.spec +++ b/pyhoca-cli.spec @@ -1,5 +1,5 @@ Name: pyhoca-cli -Version: 0.5.99.0 +Version: 0.5.99.1 Release: 0.0x2go1%{?dist} Summary: Command line X2Go client written in Python @@ -19,7 +19,7 @@ BuildRequires: fdupes %endif BuildRequires: python3-setuptools Requires: python3-setproctitle -Requires: python3-x2go >= 0.5.99.0 +Requires: python3-x2go >= 0.5.99.1 Requires: python3-argparse BuildRoot: %{_tmppath}/%{name}-%{version}-build diff --git a/pyhoca/cli/__init__.py b/pyhoca/cli/__init__.py index bebfe4a..111e8bb 100644 --- a/pyhoca/cli/__init__.py +++ b/pyhoca/cli/__init__.py @@ -25,6 +25,6 @@ For further information on X2Go, please visit the X2Go wiki: http://wiki.x2go.org """ -__VERSION__ = "0.5.99.0" +__VERSION__ = "0.5.99.1" from .frontend import * diff --git a/pyhoca/cli/frontend.py b/pyhoca/cli/frontend.py index be0fcbc..0eca99f 100644 --- a/pyhoca/cli/frontend.py +++ b/pyhoca/cli/frontend.py @@ -219,7 +219,8 @@ class PyHocaCLI(x2go.X2GoClient): """ # resume a running session self.logger('resuming X2Go session: %s' % self.args.resume, loglevel=x2go.loglevel_INFO, ) - available_sessions = self._X2GoClient__list_sessions(s_hash) + if available_sessions is None: + available_sessions = self._X2GoClient__list_sessions(s_hash) if available_sessions and self.args.resume == 'OLDEST': self._auto_resume_oldest(s_hash) elif available_sessions and self.args.resume == 'NEWEST': @@ -229,6 +230,26 @@ class PyHocaCLI(x2go.X2GoClient): else: self._runtime_error('requested session not available on X2Go server [%s]:%s' % (self.args.server, self.args.remote_ssh_port), exitcode=20) + def try_resume_session(self, s_hash): + """\ + Use C{X2GoSession} object with session UUID C{s_hash} to resume a server-side suspended X2Go session + or to take over a server-side running X2Go session. + + @param s_hash: session UUID + @type s_hash: C{str} + + """ + self.logger('trying to resume / take over X2Go session with command: %s' % self.args.command, loglevel=x2go.loglevel_INFO, ) + available_sessions = self._X2GoClient__list_sessions(s_hash, with_command=self.args.command) + if available_sessions: + self.logger('matching sessions found: %s' % available_sessions.keys(), loglevel=x2go.loglevel_INFO, ) + self.logger('picking the first in list: %s' % list(available_sessions.keys())[0], loglevel=x2go.loglevel_INFO, ) + # FIXME: what session do we want to resume really (oldest, newest, etc.)? + self._X2GoClient__resume_session(s_hash, list(available_sessions.keys())[0]) + return True + else: + return False + def share_desktop_session(self, s_hash): """\ Use C{X2GoSession} object with session UUID C{s_hash} to share a server-side X2Go desktop session that is available for sharing. @@ -535,6 +556,10 @@ class PyHocaCLI(x2go.X2GoClient): elif self.args.terminate: self.terminate_session(self.x2go_session_hash) + elif self.args.new and self.args.try_resume and self.try_resume_session(self.x2go_session_hash): + # nothing to do here, if resumption attempt was successful + pass + elif self.args.new: self.new_session(self.x2go_session_hash) -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/pyhoca-cli.git _______________________________________________ x2go-commits mailing list x2go-commits@lists.x2go.org https://lists.x2go.org/listinfo/x2go-commits