fix(data-import): fix import rule fail (#5512)
This commit is contained in:
parent
6aa61ea78d
commit
ea15aa3f9e
|
@ -67,6 +67,8 @@
|
||||||
!./bin/emqx_ctl rules create 'SELECT * FROM "t/#"' '[{"name":"data_to_webserver", "params": {"$$resource": "resource:691c29ba"}}]'
|
!./bin/emqx_ctl rules create 'SELECT * FROM "t/#"' '[{"name":"data_to_webserver", "params": {"$$resource": "resource:691c29ba"}}]'
|
||||||
?created
|
?created
|
||||||
?SH-PROMPT
|
?SH-PROMPT
|
||||||
|
?sleep 5
|
||||||
|
?SH-PROMPT
|
||||||
|
|
||||||
[shell emqx]
|
[shell emqx]
|
||||||
!./bin/emqx_ctl resources list
|
!./bin/emqx_ctl resources list
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{application, emqx_management,
|
{application, emqx_management,
|
||||||
[{description, "EMQ X Management API and CLI"},
|
[{description, "EMQ X Management API and CLI"},
|
||||||
{vsn, "4.3.5"}, % strict semver, bump manually!
|
{vsn, "4.3.6"}, % strict semver, bump manually!
|
||||||
{modules, []},
|
{modules, []},
|
||||||
{registered, [emqx_management_sup]},
|
{registered, [emqx_management_sup]},
|
||||||
{applications, [kernel,stdlib,minirest]},
|
{applications, [kernel,stdlib,minirest]},
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
%% -*- mode: erlang -*-
|
%% -*- mode: erlang -*-
|
||||||
{VSN,
|
{VSN,
|
||||||
[ {<<"4.3.[0-4]">>,
|
[ {<<"4.3.[0-5]">>,
|
||||||
[ {apply,{minirest,stop_http,['http:management']}},
|
[ {apply,{minirest,stop_http,['http:management']}},
|
||||||
{apply,{minirest,stop_http,['https:management']}},
|
{apply,{minirest,stop_http,['https:management']}},
|
||||||
{restart_application, emqx_management}
|
{restart_application, emqx_management}
|
||||||
]},
|
]},
|
||||||
{<<".*">>, []}
|
{<<".*">>, []}
|
||||||
],
|
],
|
||||||
[ {<<"4.3.[0-4]">>,
|
[ {<<"4.3.[0-5]">>,
|
||||||
[ {apply,{minirest,stop_http,['http:management']}},
|
[ {apply,{minirest,stop_http,['http:management']}},
|
||||||
{apply,{minirest,stop_http,['https:management']}},
|
{apply,{minirest,stop_http,['https:management']}},
|
||||||
{restart_application, emqx_management}
|
{restart_application, emqx_management}
|
||||||
|
|
|
@ -185,6 +185,7 @@ confs_to_binary(Confs) ->
|
||||||
|
|
||||||
-endif.
|
-endif.
|
||||||
|
|
||||||
|
-dialyzer([{nowarn_function, [import_rules/1, import_rule/1]}]).
|
||||||
import_rule(#{<<"id">> := RuleId,
|
import_rule(#{<<"id">> := RuleId,
|
||||||
<<"rawsql">> := RawSQL,
|
<<"rawsql">> := RawSQL,
|
||||||
<<"actions">> := Actions,
|
<<"actions">> := Actions,
|
||||||
|
@ -195,9 +196,11 @@ import_rule(#{<<"id">> := RuleId,
|
||||||
actions => map_to_actions(Actions),
|
actions => map_to_actions(Actions),
|
||||||
enabled => Enabled,
|
enabled => Enabled,
|
||||||
description => Desc},
|
description => Desc},
|
||||||
try emqx_rule_engine:create_rule(Rule)
|
case emqx_rule_engine:create_rule(Rule) of
|
||||||
catch throw:{resource_not_initialized, _ResId} ->
|
{ok, _} -> ok;
|
||||||
emqx_rule_engine:create_rule(Rule#{enabled => false})
|
{error, _} ->
|
||||||
|
_ = emqx_rule_engine:create_rule(Rule#{enabled => false}),
|
||||||
|
ok
|
||||||
end.
|
end.
|
||||||
|
|
||||||
map_to_actions(Maps) ->
|
map_to_actions(Maps) ->
|
||||||
|
|
Loading…
Reference in New Issue