diff options
author | Tristan Sloughter <[email protected]> | 2019-04-14 07:21:04 -0600 |
---|---|---|
committer | GitHub <[email protected]> | 2019-04-14 07:21:04 -0600 |
commit | 8ff1e44cebf3aee09969a9324c04074ba87f10b9 (patch) | |
tree | 6ba516ce5a442a3a49d21d0c9338332073382e38 /priv/templates | |
parent | 4825a495febf31f5be172d1a7e9b89a1514f1b5c (diff) | |
download | relx-8ff1e44cebf3aee09969a9324c04074ba87f10b9.tar.gz relx-8ff1e44cebf3aee09969a9324c04074ba87f10b9.tar.bz2 relx-8ff1e44cebf3aee09969a9324c04074ba87f10b9.zip |
add dist name and cookie to ERL_FLAGS for nodetool (#712)v3.31.0
* remove deprecated hex field from .app.src
* start nodetool dist node in erl flags
Diffstat (limited to 'priv/templates')
-rwxr-xr-x | priv/templates/extended_bin | 20 | ||||
-rw-r--r-- | priv/templates/nodetool | 15 |
2 files changed, 24 insertions, 11 deletions
diff --git a/priv/templates/extended_bin b/priv/templates/extended_bin index cfeb859..a4cba4a 100755 --- a/priv/templates/extended_bin +++ b/priv/templates/extended_bin @@ -189,16 +189,22 @@ relx_gen_id() { relx_nodetool() { command="$1"; shift + # Generate a unique id used to allow multiple nodetool calls to the + # same node transparently + nodetool_id="maint$(relx_gen_id)-${NAME}" + if [ -z "${START_EPMD}" ]; then - ERL_FLAGS="${ERL_FLAGS} ${MAYBE_DIST_ARGS}" "$ERTS_DIR/bin/escript" \ - "$ROOTDIR/bin/nodetool" "$NAME_TYPE" "$NAME" \ - -setcookie "$COOKIE" "$command" $@ + ERL_FLAGS="${ERL_FLAGS} ${MAYBE_DIST_ARGS} ${NAME_TYPE} $nodetool_id -setcookie ${COOKIE}" \ + "$ERTS_DIR/bin/escript" \ + "$ROOTDIR/bin/nodetool" \ + "$NAME_TYPE" "$NAME" \ + "$command" $@ else - ERL_FLAGS="${ERL_FLAGS} ${MAYBE_DIST_ARGS}" "$ERTS_DIR/bin/escript" \ - "$ROOTDIR/bin/nodetool" "$NAME_TYPE" "$NAME" \ - $START_EPMD -setcookie "$COOKIE" "$command" $@ + ERL_FLAGS="${ERL_FLAGS} ${MAYBE_DIST_ARGS} ${NAME_TYPE} $nodetool_id -setcookie ${COOKIE}" \ + "$ERTS_DIR/bin/escript" \ + "$ROOTDIR/bin/nodetool" \ + $START_EPMD "$NAME_TYPE" "$NAME" "$command" $@ fi - } # Run an escript in the node's environment diff --git a/priv/templates/nodetool b/priv/templates/nodetool index 62fa02e..9e24f32 100644 --- a/priv/templates/nodetool +++ b/priv/templates/nodetool @@ -96,16 +96,23 @@ process_args(["-setcookie", Cookie | Rest], Acc, TargetNode, StartEpmd) -> process_args(["-start_epmd", StartEpmd | Rest], Acc, TargetNode, _StartEpmd) -> process_args(Rest, Acc, TargetNode, list_to_atom(StartEpmd)); process_args(["-name", TargetName | Rest], Acc, _, StartEpmd) -> - ThisNode = append_node_suffix(TargetName, "_maint_"), - {ok, _} = net_kernel:start([ThisNode, longnames]), + maybe_start_node(TargetName, longnames), process_args(Rest, Acc, nodename(TargetName), StartEpmd); process_args(["-sname", TargetName | Rest], Acc, _, StartEpmd) -> - ThisNode = append_node_suffix(TargetName, "_maint_"), - {ok, _} = net_kernel:start([ThisNode, shortnames]), + maybe_start_node(TargetName, shortnames), process_args(Rest, Acc, nodename(TargetName), StartEpmd); process_args([Arg | Rest], Acc, Opts, StartEpmd) -> process_args(Rest, [Arg | Acc], Opts, StartEpmd). +maybe_start_node(TargetName, Names) -> + case erlang:node() of + 'nonode@nohost' -> + ThisNode = append_node_suffix(TargetName, "_maint_"), + {ok, _} = net_kernel:start([ThisNode, Names]); + _ -> + ok + end. + start_epmd(true) -> [] = os:cmd("\"" ++ epmd_path() ++ "\" -daemon"), ok; |