From dfa63ff3b1fa444f2c7089da7f4ac284e764b966 Mon Sep 17 00:00:00 2001 From: firest Date: Mon, 15 Aug 2022 10:22:18 +0800 Subject: [PATCH 1/5] fix(mgmt): remove the `will_msg` field from the client API --- apps/emqx_management/src/emqx_mgmt_api_clients.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/emqx_management/src/emqx_mgmt_api_clients.erl b/apps/emqx_management/src/emqx_mgmt_api_clients.erl index 0fd158dbd..19bf63f66 100644 --- a/apps/emqx_management/src/emqx_mgmt_api_clients.erl +++ b/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">>})}, {mountpoint, hoconsc:mk(binary(), #{desc => <<"Topic mountpoint">>})}, - {will_msg, hoconsc:mk(binary(), #{desc => <<"Client will message">>})}, {zone, hoconsc:mk(binary(), #{ desc => @@ -885,7 +884,8 @@ format_channel_info({_, ClientInfo0, ClientStats}) -> [memory, next_pkt_id, total_heap_size], 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)), Connected = maps:get(conn_state, ClientInfoMap0) =:= connected, ClientInfoMap1 = maps:merge(StatsMap, ClientInfoMap0), From 403346ea7c7ac3a8d20abe9a43fda8a9ee5e935f Mon Sep 17 00:00:00 2001 From: firest Date: Mon, 15 Aug 2022 11:39:28 +0800 Subject: [PATCH 2/5] chore: update CHANGES-5.0.md --- CHANGES-5.0.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGES-5.0.md b/CHANGES-5.0.md index 734b88515..af29aeac7 100644 --- a/CHANGES-5.0.md +++ b/CHANGES-5.0.md @@ -1,3 +1,9 @@ +# 5.0.6 + +## Bug fixes + +* remove the `will_msg` field from the client API + # 5.0.5 ## Bug fixes From 367449ee6fc26f9ce331c20c5b94d55141f4807a Mon Sep 17 00:00:00 2001 From: JianBo He Date: Mon, 15 Aug 2022 14:47:52 +0800 Subject: [PATCH 3/5] chore: update CHANGES-5.0.md --- CHANGES-5.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES-5.0.md b/CHANGES-5.0.md index af29aeac7..bf9afb3fb 100644 --- a/CHANGES-5.0.md +++ b/CHANGES-5.0.md @@ -2,7 +2,7 @@ ## Bug fixes -* remove the `will_msg` field from the client API +* Remove the needless `will_msg` field from the client API. [#8721](https://github.com/emqx/emqx/pull/8721) # 5.0.5 From f7d3f13dabf8c20ce4af8dd1f5c951d132df9656 Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Mon, 15 Aug 2022 08:51:17 +0200 Subject: [PATCH 4/5] build: fix profile check in build script --- build | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/build b/build index 99728d03e..92f033be6 100755 --- a/build +++ b/build @@ -17,10 +17,29 @@ fi PROFILE_ARG="$1" 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 PROFILE=$PROFILE_ARG @@ -91,11 +110,11 @@ make_docs() { else libs_dir3='' fi - case $PROFILE in - emqx-enterprise) + case "$(is_enterprise "$PROFILE")" in + 'yes') SCHEMA_MODULE='emqx_enterprise_conf_schema' ;; - *) + 'no') SCHEMA_MODULE='emqx_conf_schema' ;; esac @@ -290,11 +309,11 @@ export_release_vars() { local erl_opts=() - case "$profile" in - *enterprise*) + case "$(is_enterprise "$profile")" in + 'yes') erl_opts+=( "{d, 'EMQX_RELEASE_EDITION', ee}" ) ;; - *) + 'no') erl_opts+=( "{d, 'EMQX_RELEASE_EDITION', ce}" ) ;; esac From ecbf8675515cdcc7d9990ab7008fbc13d775ab9f Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Mon, 15 Aug 2022 09:16:00 +0200 Subject: [PATCH 5/5] refactor: rename Field to Struct for ref type create function Hocon type reference is actually a child-struct's struct name not necessarily the same name as the parent-sutrct's field name This commit changes the variable name for more clarity --- apps/emqx/src/emqx_schema.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/emqx/src/emqx_schema.erl b/apps/emqx/src/emqx_schema.erl index ed9821eac..574305a4f 100644 --- a/apps/emqx/src/emqx_schema.erl +++ b/apps/emqx/src/emqx_schema.erl @@ -2094,9 +2094,9 @@ sc(Type, Meta) -> hoconsc:mk(Type, Meta). 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) -> DefaultMeta = #{