Просмотр исходного кода

Merge pull request #8731 from emqx/copy-of-master

merge master into ee5.0
Xinyu Liu 3 лет назад
Родитель
Сommit
9050aa6468
4 измененных файлов с 39 добавлено и 14 удалено
  1. 6 0
      CHANGES-5.0.md
  2. 2 2
      apps/emqx/src/emqx_schema.erl
  3. 2 2
      apps/emqx_management/src/emqx_mgmt_api_clients.erl
  4. 29 10
      build

+ 6 - 0
CHANGES-5.0.md

@@ -1,3 +1,9 @@
+# 5.0.6
+
+## Bug fixes
+
+* Remove the needless `will_msg` field from the client API. [#8721](https://github.com/emqx/emqx/pull/8721)
+
 # 5.0.5
 # 5.0.5
 
 
 ## Bug fixes
 ## Bug fixes

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

@@ -2094,9 +2094,9 @@ sc(Type, Meta) -> hoconsc:mk(Type, Meta).
 
 
 map(Name, Type) -> hoconsc:map(Name, Type).
 map(Name, Type) -> hoconsc:map(Name, Type).
 
 
-ref(Field) -> hoconsc:ref(?MODULE, Field).
+ref(StructName) -> hoconsc:ref(?MODULE, StructName).
 
 
-ref(Module, Field) -> hoconsc:ref(Module, Field).
+ref(Module, StructName) -> hoconsc:ref(Module, StructName).
 
 
 mk_duration(Desc, OverrideMeta) ->
 mk_duration(Desc, OverrideMeta) ->
     DefaultMeta = #{
     DefaultMeta = #{

+ 2 - 2
apps/emqx_management/src/emqx_mgmt_api_clients.erl

@@ -538,7 +538,6 @@ fields(client) ->
             })},
             })},
         {username, hoconsc:mk(binary(), #{desc => <<"User name of client when connecting">>})},
         {username, hoconsc:mk(binary(), #{desc => <<"User name of client when connecting">>})},
         {mountpoint, hoconsc:mk(binary(), #{desc => <<"Topic mountpoint">>})},
         {mountpoint, hoconsc:mk(binary(), #{desc => <<"Topic mountpoint">>})},
-        {will_msg, hoconsc:mk(binary(), #{desc => <<"Client will message">>})},
         {zone,
         {zone,
             hoconsc:mk(binary(), #{
             hoconsc:mk(binary(), #{
                 desc =>
                 desc =>
@@ -885,7 +884,8 @@ format_channel_info({_, ClientInfo0, ClientStats}) ->
         [memory, next_pkt_id, total_heap_size],
         [memory, next_pkt_id, total_heap_size],
         maps:from_list(ClientStats)
         maps:from_list(ClientStats)
     ),
     ),
-    ClientInfoMap0 = maps:fold(fun take_maps_from_inner/3, #{}, ClientInfo2),
+    ClientInfo3 = maps:remove(will_msg, ClientInfo2),
+    ClientInfoMap0 = maps:fold(fun take_maps_from_inner/3, #{}, ClientInfo3),
     {IpAddress, Port} = peername_dispart(maps:get(peername, ClientInfoMap0)),
     {IpAddress, Port} = peername_dispart(maps:get(peername, ClientInfoMap0)),
     Connected = maps:get(conn_state, ClientInfoMap0) =:= connected,
     Connected = maps:get(conn_state, ClientInfoMap0) =:= connected,
     ClientInfoMap1 = maps:merge(StatsMap, ClientInfoMap0),
     ClientInfoMap1 = maps:merge(StatsMap, ClientInfoMap0),

+ 29 - 10
build

@@ -17,10 +17,29 @@ fi
 PROFILE_ARG="$1"
 PROFILE_ARG="$1"
 ARTIFACT="$2"
 ARTIFACT="$2"
 
 
-if [[ "${PROFILE:-${PROFILE_ARG}}" != "$PROFILE_ARG" ]]; then
-    echo "PROFILE env var is set to '$PROFILE', but '$0' arg1 is '$1'"
-    exit 1
-fi
+is_enterprise() {
+    case "$1" in
+        *enterprise*)
+            echo 'yes'
+            ;;
+        *)
+            echo 'no'
+            ;;
+    esac
+}
+PROFILE_ENV="${PROFILE:-${PROFILE_ARG}}"
+case "$(is_enterprise "$PROFILE_ARG"),$(is_enterprise "$PROFILE_ENV")" in
+    'yes,yes')
+        true
+        ;;
+    'no,no')
+        true
+        ;;
+    *)
+        echo "PROFILE env var is set to '$PROFILE_ENV', but '$0' arg1 is '$PROFILE_ARG'"
+        exit 1
+        ;;
+esac
 
 
 # make sure PROFILE is exported, it is needed by rebar.config.erl
 # make sure PROFILE is exported, it is needed by rebar.config.erl
 PROFILE=$PROFILE_ARG
 PROFILE=$PROFILE_ARG
@@ -91,11 +110,11 @@ make_docs() {
     else
     else
         libs_dir3=''
         libs_dir3=''
     fi
     fi
-    case $PROFILE in
-        emqx-enterprise)
+    case "$(is_enterprise "$PROFILE")" in
+        'yes')
             SCHEMA_MODULE='emqx_ee_conf_schema'
             SCHEMA_MODULE='emqx_ee_conf_schema'
             ;;
             ;;
-        *)
+        'no')
             SCHEMA_MODULE='emqx_conf_schema'
             SCHEMA_MODULE='emqx_conf_schema'
             ;;
             ;;
     esac
     esac
@@ -290,11 +309,11 @@ export_release_vars() {
 
 
   local erl_opts=()
   local erl_opts=()
 
 
-  case "$profile" in
-    *enterprise*)
+  case "$(is_enterprise "$profile")" in
+    'yes')
       erl_opts+=( "{d, 'EMQX_RELEASE_EDITION', ee}" )
       erl_opts+=( "{d, 'EMQX_RELEASE_EDITION', ee}" )
       ;;
       ;;
-    *)
+    'no')
       erl_opts+=( "{d, 'EMQX_RELEASE_EDITION', ce}" )
       erl_opts+=( "{d, 'EMQX_RELEASE_EDITION', ce}" )
       ;;
       ;;
   esac
   esac