[X2Go-Commits] [x2gobroker] 07/18: x2gobroker/agent.py: Better sanity checks for remote_agent and its dict keys hostname and hostaddr.

git-admin at x2go.org git-admin at x2go.org
Mon Apr 30 19:10:55 CEST 2018


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository x2gobroker.

commit 6d6b34e330767c224a9add53257db035bdfc3064
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Mon Apr 30 17:00:13 2018 +0200

    x2gobroker/agent.py: Better sanity checks for remote_agent and its dict keys hostname and hostaddr.
---
 x2gobroker/agent.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/x2gobroker/agent.py b/x2gobroker/agent.py
index 6252619..58b350c 100644
--- a/x2gobroker/agent.py
+++ b/x2gobroker/agent.py
@@ -199,11 +199,15 @@ def _call_remote_broker_agent(username, task, cmdline_args=[], remote_agent=None
     elif 'host_key_policy' not in remote_agent:
         remote_agent['host_key_policy'] = paramiko.WarningPolicy()
 
+    remote_hostaddr = None
+    remote_hostname = None
     if 'hostaddr' in remote_agent:
-        remote_hostname = remote_agent['hostaddr']
         remote_hostaddr = remote_agent['hostaddr']
-    else:
-        raise x2gobroker.x2gobroker_exceptions.X2GoBrokerAgentException('Internal error: The remote_agent dict must always specify a hostaddr key!')
+    if 'hostname' in remote_agent:
+        remote_hostname = remote_agent['hostname']
+
+    if remote_hostaddr is None and remote_hostname is None:
+        raise x2gobroker.x2gobroker_exceptions.X2GoBrokerAgentException('Internal error: The remote_agent dict must always specify either a hostaddr or a hostname key!')
 
     if 'port' in remote_agent:
         remote_port = int(remote_agent['port'])

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gobroker.git


More information about the x2go-commits mailing list