The branch, master has been updated via 976a7bf469b52fa3c710df05afa963468f653036 (commit) from 094def207ad62d51d01ed58b8fc0813cf750a9f1 (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 ----------------------------------------------------------------- commit 976a7bf469b52fa3c710df05afa963468f653036 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Mon Jun 13 23:49:34 2011 +0200 Add X2go desktop sharing support. ----------------------------------------------------------------------- Summary of changes: debian/changelog | 7 ++++ debian/control | 2 +- man/man1/pyhoca-cli.1 | 8 ++++ pyhoca-cli | 11 ++++-- pyhoca/cli/frontend.py | 84 ++++++++++++++++++++++++++++++++++-------------- 5 files changed, 83 insertions(+), 29 deletions(-) The diff of changes is: diff --git a/debian/changelog b/debian/changelog index 53f20b3..2882c60 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +pyhoca-cli (0.1.4.0-0~x2go3) UNRELEASED; urgency=low + + * New upstream version (0.1.4.0): + - Add X2go desktop sharing support. + + -- Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Mon, 13 Jun 2011 23:24:37 +0200 + pyhoca-cli (0.1.3.3-0~x2go2) unstable; urgency=low * fixes build-sequence diff --git a/debian/control b/debian/control index c646d66..4b28217 100644 --- a/debian/control +++ b/debian/control @@ -20,7 +20,7 @@ Architecture: all Depends: ${misc:Depends}, python, - python-x2go (>=0.1.0.0-0~0), + python-x2go (>=0.1.1.0-0~0), python-argparse, python-setproctitle Description: A command line X2go client written in Python diff --git a/man/man1/pyhoca-cli.1 b/man/man1/pyhoca-cli.1 index 10a2161..ef69c0f 100644 --- a/man/man1/pyhoca-cli.1 +++ b/man/man1/pyhoca-cli.1 @@ -64,6 +64,11 @@ Start a new X2go session on server (default mode if no mode is explicitly specif \*(T<\fB\-R, \-\-resume\fR \fI<SESSION_NAME>\fR\*(T> Resume existing X2go session <SESSION_NAME> on server. .TP +\*(T<\fB\-D, \-\-share-desktop\fR \fI<USER>@<DISPLAY>\fR\*(T> +Share an X2go session on the remote server specified by <USER>@<DISPLAY>, +whereas <USER> can be the same user that is starting the share mode session or any +other user that grants X2go desktop sharing for the current user. +.TP \*(T<\fB\-S, \-\-suspend\fR \fI<SESSION_NAME>\fR\*(T> Suspend running X2go session <SESSION_NAME>. .TP @@ -106,6 +111,9 @@ A comma separated list of local folders that shall be made available in the remo \*(T<\fB\-\-printing\fR\*(T> Use X2go printing (default: disabled). .TP +\*(T<\fB\-\-share-mode\fR \fI{0|1}\fR\*(T> +Share mode for X2go desktop sharing (0: view-only, 1: full access). +.TP \*(T<\fB\-\-clean-sessions\fR\*(T> Clean all of the user's suspended/running sessions before starting a new one on the named X2go server. .TP diff --git a/pyhoca-cli b/pyhoca-cli index 394a118..9838a98 100755 --- a/pyhoca-cli +++ b/pyhoca-cli @@ -92,9 +92,11 @@ liblogger = x2go.X2goLogger() action_options = [ {'args':['-N','--new'], 'default': False, 'action': 'store_true', 'help': 'start a new X2go session on server (default)', }, {'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', }, {'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':['--list-desktops'], 'default': False, 'action': 'store_true', 'help': 'list X2go desktop sessions that are available for sharing', }, {'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', }, ] @@ -116,6 +118,7 @@ x2go_options = [ {'args':['--add-to-known-hosts'], 'default': False, 'action': 'store_true', 'help': 'add RSA host key fingerprint to ~/.ssh/known_hosts if authenticity of server can\'t be established (default: not set)', }, {'args':['--sound'], 'default': 'pulse', 'choices': ('pulse', 'esd', 'none'), 'help': 'X2go server sound system (default: \'pulse\')', }, {'args':['--printing'], 'default': False, 'action': 'store_true', 'help': 'use X2go printing (default: disabled)', }, + {'args':['--share-mode'], 'default': 0, 'help': 'share mode for X2go desktop sharing (0: view-only, 1: full access)', }, {'args':['-F', '--share-local-folders'], 'metavar': '<folder1>[,<folder2[,...]]', 'default': None, 'help': 'a comma separated list of local folder names to mount in the X2go session', }, {'args':['--clean-sessions'], 'default': False, 'action': 'store_true', 'help': 'clean all suspended sessions before starting a new one', }, {'args':['--time-to-wait'], 'default': '8', 'help': 'time to wait for session startup/resume (default: 8s)', }, @@ -217,9 +220,9 @@ Possible values for the --pack NX option are: runtime_error ("argument --server is required", parser=p, exitcode=1) # check for mutual exclusiveness of -N, -R, -S, -T and -L, -N is default if none of them is set - if bool(a.new) + bool(a.resume) + bool(a.suspend) + bool(a.terminate) + bool(a.list_sessions) > 1: - runtime_error ("modes --new, --resume, --suspend, --terminate and --list-sessions are mutually exclusive", parser=p, exitcode=2) - if bool(a.new) + bool(a.resume) + bool(a.suspend) + bool(a.terminate) + bool(a.list_sessions) == 0: + if bool(a.new) + bool(a.resume) + bool(a.share_desktop) + bool(a.suspend) + bool(a.terminate) + bool(a.list_sessions) + bool(a.list_desktops) + bool(a.list_profiles)> 1: + runtime_error ("modes --new, --resume, --share-desktop, --suspend, --terminate, --list-sessions, --list-desktops and --list-profiles are mutually exclusive", parser=p, exitcode=2) + if bool(a.new) + bool(a.resume) + bool(a.share_desktop) + bool(a.suspend) + bool(a.terminate) + bool(a.list_sessions) + bool(a.list_desktops) + bool(a.list_profiles) == 0: a.new = True # check if pack method is available @@ -227,7 +230,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 or a.list_profiles): + if not (a.resume or a.share_desktop or a.suspend or a.terminate or a.list_sessions or a.list_desktops or a.list_profiles): a.new = True # X2go printing diff --git a/pyhoca/cli/frontend.py b/pyhoca/cli/frontend.py index af9a894..6656cb1 100644 --- a/pyhoca/cli/frontend.py +++ b/pyhoca/cli/frontend.py @@ -86,27 +86,48 @@ class PyHocaCLI(x2go.X2goClient): 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(): - print "Session Name: %s" % session_info - print "-------------" - print "cookie: %s" % session_info.cookie - print "agent PID: %s" % session_info.agent_pid - print "display: %s" % session_info.display - print "status: %s" % session_info.status - print "graphic port: %s" % session_info.graphics_port - print "snd port: %s" % session_info.snd_port - print "sshfs port: %s" % session_info.sshfs_port - print "username: %s" % session_info.username - print "hostname: %s" % session_info.hostname - # TODO: turn into datetime object - print "create date: %s" % session_info.date_created - # TODO: turn into datetime object - print "suspended since: %s" % session_info.date_suspended - print + if session_infos: + for session_info in session_infos.values(): + print "Session Name: %s" % session_info + print "-------------" + print "cookie: %s" % session_info.cookie + print "agent PID: %s" % session_info.agent_pid + print "display: %s" % session_info.display + print "status: %s" % session_info.status + print "graphic port: %s" % session_info.graphics_port + print "snd port: %s" % session_info.snd_port + print "sshfs port: %s" % session_info.sshfs_port + print "username: %s" % session_info.username + print "hostname: %s" % session_info.hostname + # TODO: turn into datetime object + print "create date: %s" % session_info.date_created + # TODO: turn into datetime object + print "suspended since: %s" % session_info.date_suspended + print else: print "No running/suspended sessions found on X2go server." print + def list_desktops(self, s_hash): + """\ + STILL UNDOCUMENTED + """ + # retrieve a desktop list + print + print "X2go desktops available for sharing" + print "===================================" + _peername = self._X2goClient__get_session_server_peername(s_hash) + print "Host: %s - [%s]:%s" % (self._X2goClient__get_session_server_hostname(s_hash), _peername[0], _peername[1]) + print "Username: %s" % self._X2goClient__get_session_username(s_hash) + print + desktop_list = self._X2goClient__list_desktops(s_hash) + if desktop_list: + for desktop_name in desktop_list: + print desktop_name + else: + print "No X2go desktop sessions found that are available for desktop sharing." + print + def list_profiles(self): # retrieve a session list print @@ -133,7 +154,6 @@ class PyHocaCLI(x2go.X2goClient): self.logger('cleaning up all running sessions from X2go server: %s' % _server, loglevel=x2go.loglevel_NOTICE, ) self._X2goClient__clean_sessions(s_hash) - def new_session(self, s_hash): """\ STILL UNDOCUMENTED @@ -146,7 +166,6 @@ class PyHocaCLI(x2go.X2goClient): self.logger('command from session profile to run is: %s' % self.session_registry(self.x2go_session_hash).get_session_cmd(), loglevel=x2go.loglevel_DEBUG, ) self._X2goClient__start_session(s_hash) - def resume_session(self, s_hash): """\ STILL UNDOCUMENTED @@ -159,6 +178,19 @@ 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 share_desktop_session(self, s_hash): + """\ + STILL UNDOCUMENTED + """ + # start a new session and run a command + _desktop = self.args.share_desktop + _share_mode = self.args.share_mode + self.logger('sharing X2go session: %s' % _desktop, loglevel=x2go.loglevel_INFO, ) + try: + self._X2goClient__share_desktop_session(s_hash, desktop=_desktop, share_mode=_share_mode) + except x2go.X2goDesktopSharingException, e: + self._runtime_error('%s' % str(e), exitcode=54) + def suspend_session(self, s_hash): """\ @@ -172,7 +204,6 @@ 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=21) - def terminate_session(self, s_hash): """\ STILL UNDOCUMENTED @@ -185,7 +216,6 @@ 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=22) - def __init__(self, args, logger=None, liblogger=None): """\ STILL UNDOCUMENTED @@ -245,7 +275,6 @@ class PyHocaCLI(x2go.X2goClient): share_local_folders=self.args.share_local_folders, cmd=self.args.command) - def authenticate(self): """\ STILL UNDOCUMENTED @@ -289,7 +318,6 @@ class PyHocaCLI(x2go.X2goClient): except socket.error, e: self._runtime_error('a socket error occured while establishing the connection: %s' % str(e), exitcode=-245) - def MainLoop(self): """\ STILL UNDOCUMENTED @@ -306,6 +334,11 @@ class PyHocaCLI(x2go.X2goClient): self.list_sessions(self.x2go_session_hash) sys.exit(0) + if self.args.list_desktops: + # print a beautified desktop list for the user + self.list_desktops(self.x2go_session_hash) + sys.exit(0) + if self.args.list_profiles: # print a beautified profile list for the user self.list_profiles() @@ -314,6 +347,9 @@ class PyHocaCLI(x2go.X2goClient): if self.args.resume: self.resume_session(self.x2go_session_hash) + if self.args.share_desktop: + self.share_desktop_session(self.x2go_session_hash) + elif self.args.suspend: self.suspend_session(self.x2go_session_hash) @@ -324,7 +360,7 @@ class PyHocaCLI(x2go.X2goClient): self.new_session(self.x2go_session_hash) # finally call the MainLoop of PyHocaCLI - if not (self.args.new or self.args.resume or self.args.session_profile): + if not (self.args.new or self.args.resume or self.args.share_desktop or self.args.session_profile): sys.exit(0) # give the session some time to come up... hooks/post-receive -- pyhoca-cli.git (Python X2go Client (command line client)) 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 "pyhoca-cli.git" (Python X2go Client (command line client)).