Skip to content

Commit 8adea82

Browse files
authored
chore(dev): Also use authentication for live checks (#5370)
If authentication is required via config file, the node live check of `dev/run` will fail. Now we send the basic authentication headers for the live check.
1 parent 208982e commit 8adea82

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

dev/run

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ from pbkdf2 import pbkdf2_hex
4040

4141
COMMON_SALT = uuid.uuid4().hex
4242

43-
from urllib.request import urlopen
43+
from urllib.request import *
4444
import http.client as httpclient
4545

4646

@@ -942,7 +942,7 @@ def ensure_all_nodes_alive(ctx):
942942
local_port = cluster_port(ctx, idnode)
943943
url = "http://127.0.0.1:{0}/".format(local_port)
944944
try:
945-
check_node_alive(url)
945+
check_node_alive(url, *ctx["admin"])
946946
maybe_check_clouseau_node_alive(ctx, idnode)
947947
except:
948948
pass
@@ -957,8 +957,15 @@ def ensure_all_nodes_alive(ctx):
957957

958958

959959
@log("Check node at {url}")
960-
def check_node_alive(url):
960+
def check_node_alive(url, user, pswd):
961961
error = None
962+
963+
PasswordMgr = HTTPPasswordMgrWithDefaultRealm()
964+
PasswordMgr.add_password(None, url, user, pswd)
965+
AuthHandler = HTTPBasicAuthHandler(PasswordMgr)
966+
opener = build_opener(AuthHandler)
967+
install_opener(opener)
968+
962969
for _ in range(10):
963970
try:
964971
with contextlib.closing(urlopen(url)):

0 commit comments

Comments
 (0)