You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ro...@apache.org on 2025/01/02 13:38:15 UTC

(couchdb) branch main updated: chore(dev): Also use authentication for live checks (#5370)

This is an automated email from the ASF dual-hosted git repository.

ronny pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to refs/heads/main by this push:
     new 8adea82b0 chore(dev): Also use authentication for live checks (#5370)
8adea82b0 is described below

commit 8adea82b0cea6dfacd403aef415b01b16c1dc889
Author: Ronny Berndt <ro...@apache.org>
AuthorDate: Thu Jan 2 14:38:10 2025 +0100

    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.
---
 dev/run | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/dev/run b/dev/run
index 8700646c3..85ea9622d 100755
--- a/dev/run
+++ b/dev/run
@@ -40,7 +40,7 @@ from pbkdf2 import pbkdf2_hex
 
 COMMON_SALT = uuid.uuid4().hex
 
-from urllib.request import urlopen
+from urllib.request import *
 import http.client as httpclient
 
 
@@ -942,7 +942,7 @@ def ensure_all_nodes_alive(ctx):
             local_port = cluster_port(ctx, idnode)
             url = "http://127.0.0.1:{0}/".format(local_port)
             try:
-                check_node_alive(url)
+                check_node_alive(url, *ctx["admin"])
                 maybe_check_clouseau_node_alive(ctx, idnode)
             except:
                 pass
@@ -957,8 +957,15 @@ def ensure_all_nodes_alive(ctx):
 
 
 @log("Check node at {url}")
-def check_node_alive(url):
+def check_node_alive(url, user, pswd):
     error = None
+
+    PasswordMgr = HTTPPasswordMgrWithDefaultRealm()
+    PasswordMgr.add_password(None, url, user, pswd)
+    AuthHandler = HTTPBasicAuthHandler(PasswordMgr)
+    opener = build_opener(AuthHandler)
+    install_opener(opener)
+
     for _ in range(10):
         try:
             with contextlib.closing(urlopen(url)):