Browse Source

Resolve ip from wamp url

Designate record requires an ip address and the wampagent hostname must be resolved.

Change-Id: Ief4267c9b11063134941341dff3c7e725e92ee2d
Fabio Verboso 4 months ago
parent
commit
501f930284
1 changed files with 5 additions and 2 deletions
  1. 5
    2
      iotronic/conductor/endpoints.py

+ 5
- 2
iotronic/conductor/endpoints.py View File

@@ -32,6 +32,7 @@ from oslo_config import cfg
32 32
 from oslo_log import log as logging
33 33
 import oslo_messaging
34 34
 import random
35
+import socket
35 36
 
36 37
 LOG = logging.getLogger(__name__)
37 38
 
@@ -71,7 +72,8 @@ def manage_result(res, wamp_rpc_call, board_uuid):
71 72
 def create_record_dns_webservice(ctx, board, webs_name, board_dns, zone):
72 73
     agent = objects.WampAgent.get_by_hostname(ctx, board.agent)
73 74
     wsurl = agent.wsurl
74
-    ip = wsurl.split("//")[1].split(":")[0]
75
+    w_host = wsurl.split("//")[1].split(":")[0]
76
+    ip = socket.gethostbyname(w_host)
75 77
 
76 78
     LOG.debug('Create dns record  %s for board %s',
77 79
               webs_name + "." + board_dns + "." + zone,
@@ -86,7 +88,8 @@ def create_record_dns_webservice(ctx, board, webs_name, board_dns, zone):
86 88
 def create_record_dns(ctx, board, board_dns, zone):
87 89
     agent = objects.WampAgent.get_by_hostname(ctx, board.agent)
88 90
     wsurl = agent.wsurl
89
-    ip = wsurl.split("//")[1].split(":")[0]
91
+    w_host = wsurl.split("//")[1].split(":")[0]
92
+    ip = socket.gethostbyname(w_host)
90 93
 
91 94
     LOG.debug('Create dns record  %s for board %s',
92 95
               board_dns + "." + zone,

Loading…
Cancel
Save