Quellcode durchsuchen

refactor(bin/emax): delete cold_eval

Zaiming Shi vor 4 Jahren
Ursprung
Commit
01ce32094c
3 geänderte Dateien mit 2 neuen und 35 gelöschten Zeilen
  1. 1 1
      apps/emqx/src/emqx_schema.erl
  2. 1 22
      bin/emqx
  3. 0 12
      bin/nodetool

+ 1 - 1
apps/emqx/src/emqx_schema.erl

@@ -89,7 +89,7 @@ roots(high) ->
        sc(map("name", ref("zone")),
           #{ desc => "A zone is a set of configs grouped by the zone <code>name</code>. <br>"
                      "For flexible configuration mapping, the <code>name</code> "
-                     "can be set to a listener's <code>zone</code> config . <br>"
+                     "can be set to a listener's <code>zone</code> config.<br>"
                      "NOTE: A builtin zone named <code>default</code> is auto created "
                      "and can not be deleted."
            })}

+ 1 - 22
bin/emqx

@@ -114,7 +114,7 @@ relx_usage() {
             echo "                      don't make it permanent"
             ;;
         *)
-            echo "Usage: $REL_NAME {start|start_boot <file>|ertspath|foreground|stop|pid|ping|console|console_clean|console_boot <file>|attach|remote_console|upgrade|downgrade|install|uninstall|versions|escript|ctl|rpc|rpcterms|eval|cold_eval|root_dir}"
+            echo "Usage: $REL_NAME {start|start_boot <file>|ertspath|foreground|stop|pid|ping|console|console_clean|console_boot <file>|attach|remote_console|upgrade|downgrade|install|uninstall|versions|escript|ctl|rpc|rpcterms|eval|root_dir}"
             ;;
     esac
 }
@@ -138,7 +138,6 @@ check_user() {
     fi
 }
 
-
 # Make sure the user running this script is the owner and/or su to that user
 check_user "$@"
 ES=$?
@@ -355,16 +354,6 @@ case "$1" in
         ;;
 esac
 
-IS_NO_CONNECTION_COMMAND='no'
-case "$1" in
-    cold_eval)
-        IS_NO_CONNECTION_COMMAND='yes'
-        ;;
-    *)
-        ;;
-esac
-
-
 ## Possible ways to configure emqx node name:
 ## 1. configure node.name in emqx.conf
 ## 2. override with environment variable EMQX_NODE_NAME
@@ -375,9 +364,6 @@ if [ -z "$NAME" ]; then
     if [ "$IS_BOOT_COMMAND" = 'yes' ]; then
         # for boot commands, inspect emqx.conf for node name
         NAME="$(call_hocon -s $SCHEMA_MOD -c "$RUNNER_ETC_DIR"/emqx.conf get node.name | tr -d \")"
-    elif [ "$IS_NO_CONNECTION_COMMAND" = 'yes' ]; then
-        # this command requires no connection to the target beam node, do nothing
-        :
     else
         # for non-boot commands, inspect vm.<time>.args for node name
         # shellcheck disable=SC2012,SC2086
@@ -405,9 +391,6 @@ COOKIE="${EMQX_NODE_COOKIE:-}"
 if [ -z "$COOKIE" ]; then
     if [ "$IS_BOOT_COMMAND" = 'yes' ]; then
         COOKIE="$(call_hocon -s $SCHEMA_MOD -c "$RUNNER_ETC_DIR"/emqx.conf get node.cookie | tr -d \")"
-    elif [ "$IS_NO_CONNECTION_COMMAND" = 'yes' ]; then
-        # this command requires no connection to the target beam node, do nothing
-        COOKIE="whatever"
     else
         # shellcheck disable=SC2012,SC2086
         LATEST_VM_ARGS="$(ls -t $CONFIGS_DIR/vm.*.args | head -1)"
@@ -714,10 +697,6 @@ case "$1" in
         shift
         relx_nodetool "eval" "$@"
         ;;
-    cold_eval)
-        shift;
-        "$ERTS_DIR/bin/escript" "$ROOTDIR/bin/nodetool" cold_eval "$@"
-        ;;
     *)
         relx_usage "$1"
         exit 1

+ 0 - 12
bin/nodetool

@@ -24,8 +24,6 @@ main(Args) ->
         ["hocon" | Rest] ->
             %% forward the call to hocon_cli
             hocon_cli:main(Rest);
-        ["cold_eval" | Rest] ->
-            code_eval(Rest);
         _ ->
             do(Args)
     end.
@@ -134,16 +132,6 @@ do(Args) ->
     end,
     net_kernel:stop().
 
-code_eval(Args) ->
-    Parsed = parse_eval_args(Args),
-    case erl_eval:exprs(Parsed, []) of
-        {value, Value, _} ->
-            io:format ("~p~n", [Value]);
-        Other ->
-            io:format("cold_eval_failed_with: ~p~n", [Other]),
-            halt(1)
-    end.
-
 parse_eval_args(Args) ->
     % shells may process args into more than one, and end up stripping
     % spaces, so this converts all of that to a single string to parse