This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2gobroker. commit d78451647273ea50aa4a4716b853268c286bc710 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Mon Apr 30 14:09:21 2018 +0200 x2gobroker-testagent: Convert to Python3 (using 2to3 tool). --- sbin/x2gobroker-testagent | 106 +++++++++++++++++++++++----------------------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/sbin/x2gobroker-testagent b/sbin/x2gobroker-testagent index 4c4587d..d133527 100755 --- a/sbin/x2gobroker-testagent +++ b/sbin/x2gobroker-testagent @@ -81,23 +81,23 @@ if __name__ == "__main__": if os.getuid() != 0: p.print_help() - print - print "*** The {progname} tool needs to be run with super-user privileges... ***".format(progname=PROG_NAME) - print + print () + print(("*** The {progname} tool needs to be run with super-user privileges... ***".format(progname=PROG_NAME))) + print () sys.exit(-1) if cmdline_args.username is None and not cmdline_args.list_tasks and cmdline_args.task not in ('ping', 'checkload'): p.print_help() - print - print "*** Cannot continue without username... ***" - print + print () + print ("*** Cannot continue without username... ***") + print () sys.exit(-1) if cmdline_args.task in ('suspendsession', 'terminatesession') and not cmdline_args.session_id: p.print_help() - print - print "*** Cannot continue on this task without a given session ID... ***" - print + print () + print ("*** Cannot continue on this task without a given session ID... ***") + print () sys.exit(0); if cmdline_args.config_file is not None: @@ -133,13 +133,13 @@ def call_agent(task, **kwargs): try: _result = agent_client_tasks[task](username=username, query_mode=query_mode, remote_agent=remote_agent, **kwargs) if _result == True: - print "The broker agent could be reached but the task returned no printable output (which probably is fine)." - print + print("The broker agent could be reached but the task returned no printable output (which probably is fine).") + print() return _result except KeyError: - print "No such task: '{task_name}'. Use --list-tasks to view information about".format(task_name=task) - print "available tasks." - print + print("No such task: '{task_name}'. Use --list-tasks to view information about".format(task_name=task)) + print("available tasks.") + print() return False if __name__ == "__main__": @@ -147,36 +147,36 @@ if __name__ == "__main__": # drop root privileges and run as X2GOBROKER_DAEMON_USER drop_privileges(uid=x2gobroker.defaults.X2GOBROKER_DAEMON_USER, gid=x2gobroker.defaults.X2GOBROKER_DAEMON_GROUP) - print - print "X2Go Session Broker (Agent Test Utility)" - print "----------------------------------------" + print() + print("X2Go Session Broker (Agent Test Utility)") + print("----------------------------------------") agent_client_tasks = x2gobroker.agent.tasks if 'availabletasks' in agent_client_tasks: try: remote_agent_tasks = x2gobroker.agent.tasks_available(username=username, query_mode=query_mode, remote_agent=remote_agent) - except x2gobroker.x2gobroker_exceptions.X2GoBrokerAgentException, e: - print "{errmsg}.".format(errmsg=e) - print + except x2gobroker.x2gobroker_exceptions.X2GoBrokerAgentException as e: + print("{errmsg}.".format(errmsg=e)) + print() sys.exit(0) if not local_agent and not x2gobroker.agent.has_remote_broker_agent_setup(): - print "This instance of X2Go Session Broker is not able to contact any remote" - print "X2Go Session Broker Agent instances. Check this broker's SSH setup!!!" - print - print "Aborting any futher tests..." + print("This instance of X2Go Session Broker is not able to contact any remote") + print("X2Go Session Broker Agent instances. Check this broker's SSH setup!!!") + print() + print("Aborting any futher tests...") sys.exit(-1) if list_tasks: - print "The queried broker agent supports these tasks / features:" - print + print("The queried broker agent supports these tasks / features:") + print() for task in remote_agent_tasks: try: - print " {task_name}: {task_function_obj}".format(task_name=task, task_function_obj=agent_client_tasks[task]) + print(" {task_name}: {task_function_obj}".format(task_name=task, task_function_obj=agent_client_tasks[task])) except KeyError: - print " {task_name}: not supported by this broker version".format(task_name=task) - print + print(" {task_name}: not supported by this broker version".format(task_name=task)) + print() sys.exit(0); kwargs = {} @@ -196,42 +196,42 @@ if __name__ == "__main__": result = call_agent(task, **kwargs) if type(result) is dict: - print "\n".join(result) - print + print("\n".join(result)) + print() elif task.startswith('findbusyservers') and type(result) is dict: if result: - print "\n".join([ "{host} -- {usage}%".format(host=host, usage=usage) for host, usage in result.items() ]) + print("\n".join([ "{host} -- {usage}%".format(host=host, usage=usage) for host, usage in list(result.items()) ])) else: - print "X2Go Server busy state: All servers are idle." + print("X2Go Server busy state: All servers are idle.") # even an empty dict means, that we have been successful... result = True - print + print() if task == 'addauthkey' and result: on_host = " on {host}".format(host=cmdline_args.host) if cmdline_args.host != 'LOCAL' else "" - print "NOTE: This test-run added the below SSH public key to X2Go's authorized_keys file" - print " for user '{username}{on_host}'.".format(username=username, on_host=on_host) - print - print " The file location for this normally is $HOME/.x2go/authorized_keys." - print " MAKE SURE TO REMOVE THIS KEY MANUALLY (or use test the 'delauthkey' task)!!!" - print - print pubkey - print + print("NOTE: This test-run added the below SSH public key to X2Go's authorized_keys file") + print(" for user '{username}{on_host}'.".format(username=username, on_host=on_host)) + print() + print(" The file location for this normally is $HOME/.x2go/authorized_keys.") + print(" MAKE SURE TO REMOVE THIS KEY MANUALLY (or use test the 'delauthkey' task)!!!") + print() + print(pubkey) + print() if task == 'delauthkey' and result: on_host = " on {host}".format(host=cmdline_args.host) if cmdline_args.host != 'LOCAL' else "" - print "NOTE: This test-run attempted to remove all occurences of the below SSH public key from" - print " X2Go's authorized_keys file for user '{username}{on_host}'.".format(username=username, on_host=on_host) - print - print " The file location for this normally is $HOME/.x2go/authorized_keys." - print " PLEASE DOUBLE-CHECK THE USER'S authorized_keys file MANUALLY!!!" - print - print pubkey - print + print("NOTE: This test-run attempted to remove all occurences of the below SSH public key from") + print(" X2Go's authorized_keys file for user '{username}{on_host}'.".format(username=username, on_host=on_host)) + print() + print(" The file location for this normally is $HOME/.x2go/authorized_keys.") + print(" PLEASE DOUBLE-CHECK THE USER'S authorized_keys file MANUALLY!!!") + print() + print(pubkey) + print() where = "local" if query_mode == "LOCAL" else "remote" if result: - print "The task '{task_name}' could be executed successfully on the {where} broker agent.".format(task_name=task, where=where) + print("The task '{task_name}' could be executed successfully on the {where} broker agent.".format(task_name=task, where=where)) else: - print "The task '{task_name}' failed to execute on the {where} broker agent.".format(task_name=task, where=where) - print + print("The task '{task_name}' failed to execute on the {where} broker agent.".format(task_name=task, where=where)) + print() -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gobroker.git