From 2dbf8ceea000480b4f0555309593d7ab5d9ebb46 Mon Sep 17 00:00:00 2001 From: Guillaume Raffy Date: Wed, 20 Jun 2018 08:04:29 +0000 Subject: [PATCH] Bug 2332 - mettre en service une page clusterstatus pour physix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - désormais, la page physix cluster status est disponible. Pour cela, il a fallu : - ajouter un mécanisme d'export/import de clef publique ssh utilisateur (pour que intranet.ipr.univ-rennes1.fr puisse exécuter des commandes sge sur physix-master) - adapter la view clusterstatus pour qu'elle sache gérer les commandes sge déportées. Au final, cette vue permet d'afficher le pages cluterstatus de simpatix (commandes sge locales) et physix (commandes sge déportées) --- Util.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Util.py b/Util.py index 5bad141..908a1bd 100644 --- a/Util.py +++ b/Util.py @@ -63,15 +63,21 @@ def executeCommand(command): return result -def executeCommandOn(target_machine_fqdn, strCommand): +def executeCommandOn(target_machine_fqdn, strCommand, remote_user=None): """ execute command on a local or remote machine (using ssh then) + :param str remote_user: """ print("comparing %s and %s" % (getHostName(), target_machine_fqdn.split('.')[0])) if getHostName() == target_machine_fqdn.split('.')[0]: return executeCommand(strCommand) else: - return executeProgram(['ssh', target_machine_fqdn, "%s" % strCommand]) + if not remote_user is None: + target = '%s@%s' % (remote_user, target_machine_fqdn) + else: + target = target_machine_fqdn + + return executeProgram(['ssh', target, "%s" % strCommand]) def getUpsStatus():