From 501f930284225385b991409f72e6abd87eb03972 Mon Sep 17 00:00:00 2001 From: Fabio Verboso Date: Tue, 11 Dec 2018 12:55:24 +0100 Subject: [PATCH] Resolve ip from wamp url Designate record requires an ip address and the wampagent hostname must be resolved. Change-Id: Ief4267c9b11063134941341dff3c7e725e92ee2d --- iotronic/conductor/endpoints.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/iotronic/conductor/endpoints.py b/iotronic/conductor/endpoints.py index 8602dab..cf3ddc2 100644 --- a/iotronic/conductor/endpoints.py +++ b/iotronic/conductor/endpoints.py @@ -32,6 +32,7 @@ from oslo_config import cfg from oslo_log import log as logging import oslo_messaging import random +import socket LOG = logging.getLogger(__name__) @@ -71,7 +72,8 @@ def manage_result(res, wamp_rpc_call, board_uuid): def create_record_dns_webservice(ctx, board, webs_name, board_dns, zone): agent = objects.WampAgent.get_by_hostname(ctx, board.agent) wsurl = agent.wsurl - ip = wsurl.split("//")[1].split(":")[0] + w_host = wsurl.split("//")[1].split(":")[0] + ip = socket.gethostbyname(w_host) LOG.debug('Create dns record %s for board %s', webs_name + "." + board_dns + "." + zone, @@ -86,7 +88,8 @@ def create_record_dns_webservice(ctx, board, webs_name, board_dns, zone): def create_record_dns(ctx, board, board_dns, zone): agent = objects.WampAgent.get_by_hostname(ctx, board.agent) wsurl = agent.wsurl - ip = wsurl.split("//")[1].split(":")[0] + w_host = wsurl.split("//")[1].split(":")[0] + ip = socket.gethostbyname(w_host) LOG.debug('Create dns record %s for board %s', board_dns + "." + zone,