Kaynağa Gözat

fix: keep eval command backward compatible with v4

Keeps "eval" command evaluating only Erlang expressions, even on Elixir
node.

Fixes: https://emqx.atlassian.net/browse/EMQX-8947
Paulo Zulato 2 yıl önce
ebeveyn
işleme
161435d29d

+ 1 - 1
.ci/docker-compose-file/scripts/run-emqx.sh

@@ -29,7 +29,7 @@ esac
 is_node_up() {
 is_node_up() {
   local node="$1"
   local node="$1"
   docker exec -i "$node" \
   docker exec -i "$node" \
-         bash -c "emqx eval-erl \"['emqx@node1.emqx.io','emqx@node2.emqx.io'] = maps:get(running_nodes, ekka_cluster:info()).\"" > /dev/null 2>&1
+         bash -c "emqx eval \"['emqx@node1.emqx.io','emqx@node2.emqx.io'] = maps:get(running_nodes, ekka_cluster:info()).\"" > /dev/null 2>&1
 }
 }
 
 
 is_node_listening() {
 is_node_listening() {

+ 1 - 23
bin/emqx

@@ -159,9 +159,6 @@ usage() {
         echo "Print EMQX installation root dir"
         echo "Print EMQX installation root dir"
         ;;
         ;;
     eval)
     eval)
-        echo "Evaluate an Erlang or Elixir expression in the EMQX node"
-        ;;
-    eval-erl)
         echo "Evaluate an Erlang expression in the EMQX node, even on Elixir node"
         echo "Evaluate an Erlang expression in the EMQX node, even on Elixir node"
         ;;
         ;;
     eval-ex)
     eval-ex)
@@ -231,7 +228,7 @@ usage() {
         echo "  Install Info:     ertspath | root_dir"
         echo "  Install Info:     ertspath | root_dir"
         echo "  Runtime Status:   pid | ping"
         echo "  Runtime Status:   pid | ping"
         echo "  Validate Config:  check_config"
         echo "  Validate Config:  check_config"
-        echo "  Advanced:         console_clean | escript | rpc | rpcterms | eval | eval-erl | eval-ex"
+        echo "  Advanced:         console_clean | escript | rpc | rpcterms | eval | eval-ex"
         echo ''
         echo ''
         echo "Execute '$REL_NAME COMMAND help' for more information"
         echo "Execute '$REL_NAME COMMAND help' for more information"
     ;;
     ;;
@@ -1265,25 +1262,6 @@ case "${COMMAND}" in
     eval)
     eval)
         assert_node_alive
         assert_node_alive
 
 
-        shift
-        if [ "$IS_ELIXIR" = "yes" ]
-        then
-          "$REL_DIR/elixir" \
-              --hidden \
-              --name "rand-$(relx_gen_id)-$NAME" \
-              --cookie "$COOKIE" \
-              --boot "$REL_DIR/start_clean" \
-              --boot-var RELEASE_LIB "$ERTS_LIB_DIR" \
-              --vm-args "$REL_DIR/remote.vm.args" \
-              --erl "-start_epmd false -epmd_module ekka_epmd" \
-              --rpc-eval "$NAME" "$@"
-        else
-          relx_nodetool "eval" "$@"
-        fi
-        ;;
-    eval-erl)
-        assert_node_alive
-
         shift
         shift
         relx_nodetool "eval" "$@"
         relx_nodetool "eval" "$@"
         ;;
         ;;

+ 2 - 2
bin/node_dump

@@ -49,7 +49,7 @@ done
 # Collect system info:
 # Collect system info:
 {
 {
     collect "$RUNNER_BIN_DIR"/emqx_ctl broker
     collect "$RUNNER_BIN_DIR"/emqx_ctl broker
-    collect "$RUNNER_BIN_DIR"/emqx eval-erl "'emqx_node_dump:sys_info()'"
+    collect "$RUNNER_BIN_DIR"/emqx eval "'emqx_node_dump:sys_info()'"
 
 
     collect uname -a
     collect uname -a
     collect uptime
     collect uptime
@@ -64,7 +64,7 @@ done
 
 
 # Collect information about the configuration:
 # Collect information about the configuration:
 {
 {
-    collect "$RUNNER_BIN_DIR"/emqx eval-erl "'emqx_node_dump:app_env_dump()'"
+    collect "$RUNNER_BIN_DIR"/emqx eval "'emqx_node_dump:app_env_dump()'"
 } > "${CONF_DUMP}"
 } > "${CONF_DUMP}"
 
 
 # Collect license info:
 # Collect license info:

+ 1 - 0
changes/ce/fix-10297.en.md

@@ -0,0 +1 @@
+Keeps `eval` command backward compatible with v4 by evaluating only Erlang expressions, even on Elixir node. For Elixir expressions, use `eval-ex` command.