This is an automated email from the git hooks/post-receive script. x2go pushed a commit to annotated tag 0.5.0.1 in repository x2goclient. commit 81951cf7818624e7b3ca912a35a812693dd34c65 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Fri Aug 22 23:13:19 2014 +0200 Add cmdline options --backend-<*> to enforce usage of certain Python X2Go backends for session profile, settings, control session, terminal session, etc. --- debian/changelog | 3 ++ man/man1/pyhoca-cli.1 | 35 ++++++++++++- pyhoca-cli | 130 +++++++++++++++++++++++++++++-------------------- pyhoca-cli.spec | 1 - pyhoca/cli/frontend.py | 20 +++++++- 5 files changed, 132 insertions(+), 57 deletions(-) diff --git a/debian/changelog b/debian/changelog index 0a4fd4d9..9211987b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -15,6 +15,9 @@ pyhoca-cli (0.5.0.0-0x2go1) UNRELEASED; urgency=low (mentioning X2Go Client where it should name PyHoca-CLI). - Fix description of --from-stdin option on man page. (Fixes: #485). - Rename LICENSE.txt to COPYING. + - Add cmdline options --backend-<*> to enforce usage of certain + Python X2Go backends for session profile, settings, control session, + terminal session, etc. -- Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Mon, 10 Mar 2014 15:56:42 +0100 diff --git a/man/man1/pyhoca-cli.1 b/man/man1/pyhoca-cli.1 index 9b9abcb2..53bc1e1d 100644 --- a/man/man1/pyhoca-cli.1 +++ b/man/man1/pyhoca-cli.1 @@ -203,7 +203,40 @@ Use keyboard layout (default: 'us'). .TP \*(T<\fB\-\-kbd\-type\fR \fI{auto|pc105/us|pc105/de|...}\fR\*(T> Set Keyboard type (default 'pc105/us'). Use \fIauto\fR as value here to enable X2Go's keyboard auto-detection code. -.SH COMPATIBILITY OPTIONS +.SH BACKEND OPTIONS +\fBpyhoca-gui\fR supports transparent use of different data backends. For configuration three backends are common: +FILE, GCONF (Linux only) and WINREG (Windows only). The default backend currently is the FILE backend +on all platforms. +.PP +For client-server communication the only yet implemented backend is the STDOUT backend (as X2Go server commands +print their execution results to /dev/stdout. (But other communication backends might be possible in the future...). +.PP +In the same way we are focusing on a successor of the current NX3 agent/proxy tool. A change in the proxy backend +will also be implemented as a backend. +.TP +\*(T<\fB\-\-backend-controlsession <CONTROLSESSION_BACKEND>\fR\*(T> +Force usage of a certain CONTROLSESSION_BACKEND (do not use this unless you know exactly what you are doing). +.TP +\*(T<\fB\-\-backend-terminalsession <TERMINALSESSION_BACKEND>\fR\*(T> +Force usage of a certain TERMINALSESSION_BACKEND (do not use this unless you know exactly what you are doing). +.TP +\*(T<\fB\-\-backend-serversessioninfo <SERVERSESSIONINFO_BACKEND>\fR\*(T> +Force usage of a certain SERVERSESSIONINFO_BACKEND (do not use this unless you know exactly what you are doing). +.TP +\*(T<\fB\-\-backend-serversessionlist <SERVERSESSIONLIST_BACKEND>\fR\*(T> +Force usage of a certain SERVERSESSIONLIST_BACKEND (do not use this unless you know exactly what you are doing). +.TP +\*(T<\fB\-\-backend-proxy <PROXY_BACKEND>\fR\*(T> +Force usage of a certain PROXY_BACKEND (do not use this unless you know exactly what you are doing). +.TP +\*(T<\fB\-\-backend-sessionprofiles <SESSIONPROFILES_BACKEND>\fR\*(T> +Use given backend for accessing session profiles, available backends on Linux: FILES, GCONF; on Windows: FILES, WINREG. +.TP +\*(T<\fB\-\-backend-clientsettings <CLIENTSETTINGS_BACKEND>\fR\*(T> +Use given backend for accessing the client settings configuration, available backends on Linux: FILES, GCONF; on Windows: FILES, WINREG. +.TP +\*(T<\fB\-\-backend-clientprinting <CLIENTPRINTING_BACKEND>\fR\*(T> +Use given backend for accessing the client printing configuration, available backends on Linux: FILES, GCONF; on Windows: FILES, WINREG..SH COMPATIBILITY OPTIONS \fBpyhoca-cli\fR aims at being fully compatible with all command line options and session config files of the X2Go project's X2Go command line client \fBx2goclient-cli\fR as well as the \fBx2goclient\fR GUI. This is still work in progress. To achieve this, some compatibility options have already diff --git a/pyhoca-cli b/pyhoca-cli index 523be1c5..7ffecc53 100755 --- a/pyhoca-cli +++ b/pyhoca-cli @@ -31,9 +31,6 @@ import x2go import sys import os -import sys -import os - PROG_NAME = os.path.basename(sys.argv[0]).replace('.exe', '') PROG_PID = os.getpid() @@ -107,6 +104,7 @@ from x2go.defaults import X2GO_PRINT_ACTIONS from x2go.defaults import DEFAULT_PDFVIEW_CMD from x2go.defaults import DEFAULT_PDFSAVE_LOCATION from x2go.defaults import DEFAULT_PRINTCMD_CMD +from x2go import BACKENDS from pyhoca.cli import current_home, PyHocaCLI, runtime_error @@ -149,57 +147,80 @@ if _X2GOCLIENT_OS == "Linux": ) # debug options... -debug_options = [ - {'args':['-d','--debug'], 'default': False, 'action': 'store_true', 'help': 'enable application debugging code', }, - {'args':['--quiet'], 'default': False, 'action': 'store_true', 'help': 'disable any kind of log output', }, - {'args':['--libdebug'], 'default': False, 'action': 'store_true', 'help': 'enable debugging code of the underlying Python X2Go module', }, - {'args':['--libdebug-sftpxfer'], 'default': False, 'action': 'store_true', 'help': 'enable debugging code of Python X2Go\'s sFTP server code (very verbose, and even promiscuous)', }, - {'args':['-V', '--version'], 'default': False, 'action': 'store_true', 'help': 'print version number and exit', }, - ] +debug_options = [ + {'args':['-d','--debug'], 'default': False, 'action': 'store_true', 'help': 'enable application debugging code', }, + {'args':['--quiet'], 'default': False, 'action': 'store_true', 'help': 'disable any kind of log output', }, + {'args':['--libdebug'], 'default': False, 'action': 'store_true', 'help': 'enable debugging code of the underlying Python X2Go module', }, + {'args':['--libdebug-sftpxfer'], 'default': False, 'action': 'store_true', 'help': 'enable debugging code of Python X2Go\'s sFTP server code (very verbose, and even promiscuous)', }, + {'args':['-V', '--version'], 'default': False, 'action': 'store_true', 'help': 'print version number and exit', }, + ] # possible programme options are -x2go_options = [ - # NOT IMPLEMENTED {'args':['--config'], 'default': '~/.x2goclient/sessions', 'help': 'x2goclient config file containing x2go session settings (default: ~/.x2goclient/sessions)', }, - {'args':['-c','--command'], 'default': 'TERMINAL', 'help': 'command to run with -R mode on server (default: xterm)', }, - {'args':['-u','--username'], 'default': None, 'help': 'username for the session (default: current user)', }, - {'args':['--password'], 'default': None, 'help': 'user password for session authentication', }, - {'args':['-p','--remote-ssh-port'], 'default': '22', 'help': 'remote SSH port (default: 22)', }, - {'args':['-k','--ssh-privkey'], 'default': None, 'help': 'use file \'SSH_PRIVKEY\' as private key for the SSH connection (e.g. ~/.ssh/id_rsa)', }, - {'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':['--terminate-on-ctrl-c'], 'default': False, 'action': 'store_true', 'help': 'terminate the connected session when pressing CTRL+C (instead of suspending the session)', }, - {'args':['--auth-attempts'], 'default': 3, 'help': 'number of authentication attempts before authentication fails (default: 3)', }, - ] -print_options = [ - {'args':['--print-action'], 'default': 'PDFVIEW', 'choices': PRINT_ACTIONS, 'help': 'action to be performed for incoming X2Go print jobs (default: \'PDFVIEW\')', }, - {'args':['--pdfview-cmd'], 'default': None, 'help': 'PDF viewer command for displaying incoming X2Go print jobs (default: \'%s\'); this option selects \'--print-action PDFVIEW\'' % DEFAULT_PDFVIEW_CMD,}, - {'args':['--save-to-folder'], 'default': None, 'metavar': 'PRINT_DEST', 'help': 'save print jobs as PDF files to folder PRINT_DEST (default: \'%s\'); this option selects \'--print-action PDFSAVE\'' % DEFAULT_PDFSAVE_LOCATION,}, - {'args':['--printer'], 'default': None, 'help': 'target CUPS print queue for incoming X2Go print jobs (default: CUPS default printer); this option selects \'--print-action CUPS\'',}, - {'args':['--print-cmd'], 'default': None, 'help': 'print command including cmd line arguments (default: \'%s\'); this option selects \'--print-action PRINTCMD\'' % DEFAULT_PRINTCMD_CMD,}, - ] -broker_options = [ - {'args':['-B','--broker-url'], 'default': None, 'help': 'retrieve session profiles via an X2Go Session Broker under the given URL', }, - {'args':['--broker-password'], 'default': None, 'help': 'password for authenticating against the X2Go Session Broker', }, - ] - -nx_options = [ - {'args':['-g','--geometry'], 'default': '800x600','help': 'screen geometry: \'<width>x<height>\' or \'fullscreen\' (default: \'800x600\')',}, - {'args':['-q','--link'], 'default': 'adsl', 'choices': ('modem','isdn','adsl','wan','lan'), 'help': 'link quality (default: \'adsl\')',}, - {'args':['-t','--session-type'], 'default': 'application', 'choices': ('desktop', 'application'), 'help': 'session type (default: \'application\')', }, - {'args':['--pack'], 'default': '16m-jpeg-9', 'help': 'compression methods (see below for possible values)', }, - {'args':['--kbd-layout'], 'default': 'us', 'help': 'use keyboard layout (default: \'us\')',}, - {'args':['--kbd-type'], 'default': 'pc105/us', 'help': 'set Keyboard type (default: \'pc105/us\')',}, - ] -compat_options = [ - {'args':['--port'], 'default': None, 'help': 'compatibility option, synonymous to --remote-ssh-port PORT', }, - {'args':['--ssh-key'], 'default': None, 'help': 'compatibility option, synonymous to --ssh-privkey SSH_KEY', }, - {'args':['--use-sound'], 'default': None, 'choices': ('yes', 'no'), 'help': 'compatibility option, synonymous to --sound {pulse|none}', }, - {'args':['--client-ssh-port'], 'default': None, 'help': 'compatibility option for the x2goclient GUI; as Python X2Go brings its own internal SFTP server, this option will be ignored', }, - ] - +x2go_options = [ + # NOT IMPLEMENTED {'args':['--config'], 'default': '~/.x2goclient/sessions', 'help': 'x2goclient config file containing x2go session settings (default: ~/.x2goclient/sessions)', }, + {'args':['-c','--command'], 'default': 'TERMINAL', 'help': 'command to run with -R mode on server (default: xterm)', }, + {'args':['-u','--username'], 'default': None, 'help': 'username for the session (default: current user)', }, + {'args':['--password'], 'default': None, 'help': 'user password for session authentication', }, + {'args':['-p','--remote-ssh-port'], 'default': '22', 'help': 'remote SSH port (default: 22)', }, + {'args':['-k','--ssh-privkey'], 'default': None, 'help': 'use file \'SSH_PRIVKEY\' as private key for the SSH connection (e.g. ~/.ssh/id_rsa)', }, + {'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':['--terminate-on-ctrl-c'], 'default': False, 'action': 'store_true', 'help': 'terminate the connected session when pressing CTRL+C (instead of suspending the session)', }, + {'args':['--auth-attempts'], 'default': 3, 'help': 'number of authentication attempts before authentication fails (default: 3)', }, + ] +print_options = [ + {'args':['--print-action'], 'default': 'PDFVIEW', 'choices': PRINT_ACTIONS, 'help': 'action to be performed for incoming X2Go print jobs (default: \'PDFVIEW\')', }, + {'args':['--pdfview-cmd'], 'default': None, 'help': 'PDF viewer command for displaying incoming X2Go print jobs (default: \'%s\'); this option selects \'--print-action PDFVIEW\'' % DEFAULT_PDFVIEW_CMD,}, + {'args':['--save-to-folder'], 'default': None, 'metavar': 'PRINT_DEST', 'help': 'save print jobs as PDF files to folder PRINT_DEST (default: \'%s\'); this option selects \'--print-action PDFSAVE\'' % DEFAULT_PDFSAVE_LOCATION,}, + {'args':['--printer'], 'default': None, 'help': 'target CUPS print queue for incoming X2Go print jobs (default: CUPS default printer); this option selects \'--print-action CUPS\'',}, + {'args':['--print-cmd'], 'default': None, 'help': 'print command including cmd line arguments (default: \'%s\'); this option selects \'--print-action PRINTCMD\'' % DEFAULT_PRINTCMD_CMD,}, + ] +broker_options = [ + {'args':['-B','--broker-url'], 'default': None, 'help': 'retrieve session profiles via an X2Go Session Broker under the given URL', }, + {'args':['--broker-password'], 'default': None, 'help': 'password for authenticating against the X2Go Session Broker', }, + ] + +nx_options = [ + {'args':['-g','--geometry'], 'default': '800x600','help': 'screen geometry: \'<width>x<height>\' or \'fullscreen\' (default: \'800x600\')',}, + {'args':['-q','--link'], 'default': 'adsl', 'choices': ('modem','isdn','adsl','wan','lan'), 'help': 'link quality (default: \'adsl\')',}, + {'args':['-t','--session-type'], 'default': 'application', 'choices': ('desktop', 'application'), 'help': 'session type (default: \'application\')', }, + {'args':['--pack'], 'default': '16m-jpeg-9', 'help': 'compression methods (see below for possible values)', }, + {'args':['--kbd-layout'], 'default': 'us', 'help': 'use keyboard layout (default: \'us\')',}, + {'args':['--kbd-type'], 'default': 'pc105/us', 'help': 'set Keyboard type (default: \'pc105/us\')',}, + ] +compat_options = [ + {'args':['--port'], 'default': None, 'help': 'compatibility option, synonymous to --remote-ssh-port PORT', }, + {'args':['--ssh-key'], 'default': None, 'help': 'compatibility option, synonymous to --ssh-privkey SSH_KEY', }, + {'args':['--use-sound'], 'default': None, 'choices': ('yes', 'no'), 'help': 'compatibility option, synonymous to --sound {pulse|none}', }, + {'args':['--client-ssh-port'], 'default': None, 'help': 'compatibility option for the x2goclient GUI; as Python X2Go brings its own internal SFTP server, this option will be ignored', }, + ] + +_profiles_backend_default = BACKENDS['X2GoSessionProfiles']['default'] +_settings_backend_default = BACKENDS['X2GoClientSettings']['default'] +_printing_backend_default = BACKENDS['X2GoClientPrinting']['default'] + +if _X2GOCLIENT_OS == 'Windows': + _config_backends = ('FILE', 'WINREG') +elif _X2GOCLIENT_OS == 'Linux': + _config_backends = ('FILE', 'GCONF') +else: + _config_backends = ('FILE') + + + +backend_options = [ + {'args':['--backend-controlsession'], 'default': None, 'metavar': '<CONTROLSESSION_BACKEND>', 'choices': BACKENDS['X2GoControlSession'].keys(), 'help': 'force usage of a certain CONTROLSESSION_BACKEND (do not use this unless you know exactly what you are doing)', }, + {'args':['--backend-terminalsession'], 'default': None, 'metavar': '<TERMINALSESSION_BACKEND>', 'choices': BACKENDS['X2GoTerminalSession'].keys(), 'help': 'force usage of a certain TERMINALSESSION_BACKEND (do not use this unless you know exactly what you are doing)', }, + {'args':['--backend-serversessioninfo'], 'default': None, 'metavar': '<SERVERSESSIONINFO_BACKEND>', 'choices': BACKENDS['X2GoServerSessionInfo'].keys(), 'help': 'force usage of a certain SERVERSESSIONINFO_BACKEND (do not use this unless you know exactly what you are doing)', }, + {'args':['--backend-serversessionlist'], 'default': None, 'metavar': '<SERVERSESSIONLIST_BACKEND>', 'choices': BACKENDS['X2GoServerSessionList'].keys(), 'help': 'force usage of a certain SERVERSESSIONLIST_BACKEND (do not use this unless you know exactly what you are doing)', }, + {'args':['--backend-proxy'], 'default': None, 'metavar': '<PROXY_BACKEND>', 'choices': BACKENDS['X2GoProxy'].keys(), 'help': 'force usage of a certain PROXY_BACKEND (do not use this unless you know exactly what you are doing)', }, + {'args':['--backend-sessionprofiles'], 'default': None, 'metavar': '<SESSIONPROFILES_BACKEND>', 'choices': _config_backends, 'help': 'use given backend for accessing session profiles, available backends on your system: %s (default: %s)' % (', '.join(_config_backends), _profiles_backend_default), }, + {'args':['--backend-clientsettings'], 'default': None, 'metavar': '<CLIENTSETTINGS_BACKEND>', 'choices': _config_backends, 'help': 'use given backend for accessing the client settings configuration, available backends on your system: %s (default: %s)' % (', '.join(_config_backends), _settings_backend_default), }, + {'args':['--backend-clientprinting'], 'default': None, 'metavar': '<CLIENTPRINTING_BACKEND>', 'choices': _config_backends, 'help': 'use given backend for accessing the client printing configuration, available backends on your system: %s (default: %s)' % (', '.join(_config_backends), _printing_backend_default), }, + ] ### ### beginning of code @@ -232,9 +253,10 @@ Possible values for the --pack NX option are: p_printopts = p.add_argument_group('X2Go print options') p_brokeropts = p.add_argument_group('X2Go Session Broker client options') p_nxopts = p.add_argument_group('NX options') + p_backendopts = p.add_argument_group('Python X2Go backend options (for experts only)') p_compatopts = p.add_argument_group('compatibility options') - for (p_group, opts) in ((p_x2goopts, x2go_options), (p_printopts, print_options), (p_brokeropts, broker_options), (p_actionopts, action_options), (p_debugopts, debug_options), (p_nxopts, nx_options), (p_compatopts, compat_options)): + for (p_group, opts) in ((p_x2goopts, x2go_options), (p_printopts, print_options), (p_brokeropts, broker_options), (p_actionopts, action_options), (p_debugopts, debug_options), (p_nxopts, nx_options), (p_backendopts, backend_options), (p_compatopts, compat_options)): required = False for opt in opts: diff --git a/pyhoca-cli.spec b/pyhoca-cli.spec index b56d1089..f3920632 100644 --- a/pyhoca-cli.spec +++ b/pyhoca-cli.spec @@ -13,7 +13,6 @@ BuildRequires: python2-devel BuildRequires: python-setuptools Requires: python-setproctitle Requires: python-x2go -Requires: notify-python Requires: python-argparse %description diff --git a/pyhoca/cli/frontend.py b/pyhoca/cli/frontend.py index 1a49cf8d..6344bb83 100644 --- a/pyhoca/cli/frontend.py +++ b/pyhoca/cli/frontend.py @@ -330,10 +330,28 @@ class PyHocaCLI(x2go.X2GoClient): self._pyhoca_logger = copy.deepcopy(logger) self._pyhoca_logger.tag = 'PyHocaCLI' + _backend_kwargs = {} + if self.args.backend_controlsession is not None: + _backend_kwargs['control_backend'] = self.args.backend_controlsession + if self.args.backend_terminalsession is not None: + _backend_kwargs['terminal_backend'] = self.args.backend_terminalsession + if self.args.backend_serversessioninfo is not None: + _backend_kwargs['info_backend'] = self.args.backend_serversessioninfo + if self.args.backend_serversessionlist is not None: + _backend_kwargs['list_backend'] = self.args.backend_serversessionlist + if self.args.backend_proxy is not None: + _backend_kwargs['proxy_backend'] = self.args.backend_proxy + if self.args.backend_sessionprofiles is not None: + _backend_kwargs['profiles_backend'] = self.args.backend_sessionprofiles + if self.args.backend_clientsettings is not None: + _backend_kwargs['settings_backend'] = self.args.backend_clientsettings + if self.args.backend_clientprinting is not None: + _backend_kwargs['printing_backend'] = self.args.backend_clientprinting + # initialize the X2GoClient context and start the connection to the X2Go server self._pyhoca_logger('preparing requested X2Go session', loglevel=x2go.loglevel_NOTICE, ) - x2go.X2GoClient.__init__(self, broker_url=self.args.broker_url, broker_password=self.args.broker_password, logger=liblogger) + x2go.X2GoClient.__init__(self, broker_url=self.args.broker_url, broker_password=self.args.broker_password, logger=liblogger, **_backend_kwargs) _profiles = self._X2GoClient__get_profiles() if self.args.session_profile and not _profiles.has_profile(self.args.session_profile): -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goclient.git