Skip to content

Commit 0107000

Browse files
mcpaddyyonsken
authored andcommitted
MB-49557 [BP] Server-eshell passes the cookies via environment variable
This is a backport of MB-48206. Change-Id: I22c58e8a8b11ad1d47e8d3c5dd03becd588e731b Reviewed-on: https://review.couchbase.org/c/couchbase-cli/+/166442 Tested-by: Build Bot <build@couchbase.com> Reviewed-by: James Lee <james.lee@couchbase.com> Reviewed-on: https://review.couchbase.org/c/couchbase-cli/+/172453 Well-Formed: Restriction Checker
1 parent d39dc1b commit 0107000

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

cbmgr.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1939,16 +1939,19 @@ def execute(self, opts):
19391939
temp.write(f'[{{preferred_local_proto,{result["addressFamily"]}_tcp_dist}}].'.encode())
19401940
temp.flush()
19411941
temp_name = temp.name
1942+
env = os.environ.copy()
1943+
env["CB_COOKIE"] = cookie
19421944

1943-
args = [path, '-name', name, '-setcookie', cookie, '-hidden', '-remsh', node, '-proto_dist', 'cb',
1944-
'-epmd_module', 'cb_epmd', '-pa', CB_NS_EBIN_PATH, '-kernel', 'dist_config_file',
1945-
f'"{temp_name}"'] + CB_INETRC_OPT
1945+
args = [path, '-name', name, '-setcookie', 'nocookie', '-hidden', '-eval',
1946+
'erlang:set_cookie(list_to_atom(os:getenv("CB_COOKIE"))).',
1947+
'-remsh', node, '-proto_dist', 'cb', '-epmd_module', 'cb_epmd', '-pa', CB_NS_EBIN_PATH, '-kernel',
1948+
'dist_config_file', f'"{temp_name}"'] + CB_INETRC_OPT
19461949

19471950
if opts.debug:
19481951
print(f'Running {" ".join(args)}')
19491952

19501953
try:
1951-
subprocess.call(args)
1954+
subprocess.call(args, env=env)
19521955
except OSError:
19531956
_exit_if_errors(["Unable to find the erl executable"])
19541957

0 commit comments

Comments
 (0)