extended_bin does not account for cookie being set in an extended vm.args
artman41 opened this issue · comments
If I have 2 vm.args files where 1 of the files inherits the cookie from a different file:
file1.vm.args
-cookie test_cookie
file2.vm.args
-args_file file1.vm.args
Then the following line in extended_bin
will not work and will instead use the cookie in ~/.erlang.cookie
relx/priv/templates/extended_bin
Lines 723 to 740 in d2add7c
Even though the recursion is validated a few lines prior
relx/priv/templates/extended_bin
Lines 612 to 661 in d2add7c
Thanks, yea, I guess we need to utilize the files
array to check all of them for everything (not just COOKIE, but dist args too).
@tsloughter just wrote this function which I'm going to put copy into our extended_bin
after relx creates it, I'm thinking it can replace the call on line 728, any use?
function get_cookie() {
local vm_args_file="$1";
if [[ -z "$vm_args_file" ]]; then
echo 'vm_args_file was empty!' >&2;
exit 1;
fi;
local cookie="$(grep '^-setcookie' $vm_args_file)";
for args_file in $(grep '^-args_file' $vm_args_file | awk '{print $2}'); do
local new_cookie="$(get_cookie $args_file)";
if [[ -n "$new_cookie" ]]; then
cookie=$new_cookie;
fi;
done;
echo $cookie;
}