summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbderrahim Kitouni <akitouni@gnome.org>2020-03-22 11:31:39 +0100
committerAbderrahim Kitouni <akitouni@gnome.org>2020-03-22 11:31:59 +0100
commit2330501ba3b81e86d4a77173542659ae8f82e25d (patch)
treec176655f5636a7af1691d989a9c951781de21dc2
parentc7c38d73fd8e433eb61b602f826282ec41e78bf6 (diff)
downloadbuildstream-abderrahim/resolve-remotes.tar.gz
_sandboxremote: resolve hostname before sending to grpcabderrahim/resolve-remotes
-rw-r--r--src/buildstream/sandbox/_sandboxremote.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/buildstream/sandbox/_sandboxremote.py b/src/buildstream/sandbox/_sandboxremote.py
index 3dcbb2ccc..f98c9340f 100644
--- a/src/buildstream/sandbox/_sandboxremote.py
+++ b/src/buildstream/sandbox/_sandboxremote.py
@@ -22,6 +22,7 @@ import os
import shutil
from collections import namedtuple
from urllib.parse import urlparse
+from socket import gethostbyname
from functools import partial
import grpc
@@ -353,10 +354,13 @@ class SandboxRemote(SandboxREAPI):
"You must supply a protocol and port number in the execution-service url, "
"for example: http://buildservice:50051."
)
+
+ host = gethostbyname(url.hostname)
+
if url.scheme == "http":
- channel = grpc.insecure_channel("{}:{}".format(url.hostname, url.port))
+ channel = grpc.insecure_channel("{}:{}".format(host, url.port))
elif url.scheme == "https":
- channel = grpc.secure_channel("{}:{}".format(url.hostname, url.port), self.exec_credentials)
+ channel = grpc.secure_channel("{}:{}".format(host, url.port), self.exec_credentials)
else:
raise SandboxError(
"Remote execution currently only supports the 'http' protocol "
@@ -410,10 +414,13 @@ class SandboxRemote(SandboxREAPI):
"You must supply a protocol and port number in the action-cache-service url, "
"for example: http://buildservice:50051."
)
+
+ host = gethostbyname(url.hostname)
+
if url.scheme == "http":
- channel = grpc.insecure_channel("{}:{}".format(url.hostname, url.port))
+ channel = grpc.insecure_channel("{}:{}".format(host, url.port))
elif url.scheme == "https":
- channel = grpc.secure_channel("{}:{}".format(url.hostname, url.port), self.action_credentials)
+ channel = grpc.secure_channel("{}:{}".format(host, url.port), self.action_credentials)
with channel:
request = remote_execution_pb2.GetActionResultRequest(