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

pgj pushed a commit to branch jenkins-clouseau-windows-test
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit e0b72942bdbe937725948c08624e5d5499ed98fd
Author: Gabor Pali <[email protected]>
AuthorDate: Sun May 4 18:00:02 2025 +0200

    dev/run: complete Erlang cookie configuration
    
    The `--erlang-cookie` configuration flag for the `dev/run` script
    does not propagate the cookie value for `vm.args` so that the
    nodes will not have it configured on starting up.  That is why,
    for example, pinging the Clouseau nodes with user-provided cookie
    will not work, as well as Clouseau nodes will not be able to
    connect even though they picked up the right value already.
    
    Add the missing parts to tweak `vm.args` accordingly and make the
    Erlang cookie configurable through the `Makefile` too.
---
 Makefile |  4 ++++
 dev/run  | 23 +++++++++++++++--------
 2 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index 8b1df51e6..fdab740a0 100644
--- a/Makefile
+++ b/Makefile
@@ -95,6 +95,10 @@ EXUNIT_OPTS=$(subst $(comma),$(space),$(tests))
 
 TEST_OPTS="-c 'startup_jitter=0' -c 'default_security=admin_local' -c 
'iterations=9'"
 
+ifneq ($(ERLANG_COOKIE),)
+TEST_OPTS+=" --erlang-cookie=$(ERLANG_COOKIE)"
+endif
+
 
################################################################################
 # Main commands
 
################################################################################
diff --git a/dev/run b/dev/run
index 85ea9622d..478fb2ae9 100755
--- a/dev/run
+++ b/dev/run
@@ -515,7 +515,7 @@ def write_config(ctx, node, env):
             content = apply_config_overrides(ctx, content)
         elif base == "local.ini":
             content = hack_local_ini(ctx, content)
-        elif ctx["enable_tls"] and base == "vm.args":
+        elif base == "vm.args":
             content = hack_vm_args(ctx, node, content)
 
         with open(tgt, "w") as handle:
@@ -839,16 +839,23 @@ def hack_local_ini(ctx, contents):
 
 
 def hack_vm_args(ctx, node, contents):
-    contents += f"""
+    if ctx["enable_tls"]:
+        contents += f"""
 -proto_dist couch
 -couch_dist no_tls '"clouseau{node[-1]}@127.0.0.1"'
 -ssl_dist_optfile {ctx["rootdir"]}/src/couch_dist/certs/out/couch_dist.conf
-    """
-    if ctx["no_tls"]:
-        no_tls_nodes = ctx["no_tls"].split(",")
-        for node_name in no_tls_nodes:
-            node_name = node_name if "@" in node_name else 
f"{node_name}@127.0.0.1"
-            contents += f"""\n-couch_dist no_tls '"{node_name}"'"""
+"""
+        if ctx["no_tls"]:
+            no_tls_nodes = ctx["no_tls"].split(",")
+            for node_name in no_tls_nodes:
+                node_name = node_name if "@" in node_name else 
f"{node_name}@127.0.0.1"
+                contents += f"""
+-couch_dist no_tls '"{node_name}"'
+"""
+    if ctx["erlang_cookie"]:
+        contents += f"""
+-setcookie {ctx["erlang_cookie"]}
+"""
     return contents
 
 

Reply via email to