Browse Source

Umbrella fix build (#5)

* fix(emqx_auth_jwt): Dialyzer warnings

* fix(emqx_auth_mnesia_cli): Dialyzer warnings

* fix(emqx_bridge_mqtt_cli): Dialyzer warnings

* fix(emqx_bridge_mqtt_cli): Dialyzer warnings

* fix(emqx_auth_redis_sup): Dialyzer warnings

* fix(emqx_bridge_mqtt): Dialyzer warnings

* fix(emqx_auth_pgsql_cli): Dialyzer warnings

* fix(emqx_bridge_mqtt_cli): Dialyzer warnings

* fix(emqx_auth_mnesia_cli): Dialyzer warnings
Ayodele 5 năm trước cách đây
mục cha
commit
13b67c0d19

+ 6 - 0
apps/emqx_auth_mnesia/src/emqx_auth_mnesia_cli.erl

@@ -156,11 +156,17 @@ auth_username_cli(["add", Username, Password]) ->
         {error, Reason} -> emqx_ctl:print("Error: ~p~n", [Reason])
     end;
 
+<<<<<<< HEAD
 auth_username_cli(["update", Username, NewPassword]) ->
     case update_user({username, iolist_to_binary(Username)}, iolist_to_binary(NewPassword)) of
         ok -> emqx_ctl:print("ok~n");
         {error, Reason} -> emqx_ctl:print("Error: ~p~n", [Reason])
     end;
+=======
+acl_cli(["del", Login, Topic])->
+    ok = remove_acl(iolist_to_binary(Login), iolist_to_binary(Topic)),
+    emqx_ctl:print("ok~n");
+>>>>>>> bb37bac5... Umbrella fix build (#5)
 
 auth_username_cli(["del", Username]) ->
     case  remove_user({username, iolist_to_binary(Username)}) of

+ 4 - 0
apps/emqx_auth_pgsql/src/emqx_auth_pgsql_cli.erl

@@ -29,6 +29,8 @@
         , equery/3
         ]).
 
+-type client_info() :: #{username:=_, clientid:=_, peerhost:=_, _=>_}.
+
 %%--------------------------------------------------------------------
 %% Avoid SQL Injection: Parse SQL to Parameter Query.
 %%--------------------------------------------------------------------
@@ -104,9 +106,11 @@ conn_opts([Opt = {ssl_opts, _}|Opts], Acc) ->
 conn_opts([_Opt|Opts], Acc) ->
     conn_opts(Opts, Acc).
 
+-spec(equery(atom(), string() | epgsql:statement(), Parameters::[any()]) -> {ok, ColumnsDescription :: [any()], RowsValues :: [any()]} | {error, any()} ).
 equery(Pool, Sql, Params) ->
     ecpool:with_client(Pool, fun(C) -> epgsql:prepared_query(C, Sql, Params) end).
 
+-spec(equery(atom(), string() | epgsql:statement(), Parameters::[any()], client_info()) ->  {ok, ColumnsDescription :: [any()], RowsValues :: [any()]} | {error, any()} ).
 equery(Pool, Sql, Params, ClientInfo) ->
     ecpool:with_client(Pool, fun(C) -> epgsql:prepared_query(C, Sql, replvar(Params, ClientInfo)) end).
 

+ 2 - 3
apps/emqx_bridge_mqtt/src/emqx_bridge_mqtt.erl

@@ -186,6 +186,5 @@ replvar([Key|More], Options) ->
 
 %% ${node} => node()
 feedvar(clientid, ClientId, _) ->
-    iolist_to_binary(re:replace(ClientId, "\\${node}", atom_to_list(node())));
-feedvar(_, Val, _) ->
-    Val.
+    iolist_to_binary(re:replace(ClientId, "\\${node}", atom_to_list(node()))).
+

+ 6 - 12
apps/emqx_bridge_mqtt/src/emqx_bridge_mqtt_cli.erl

@@ -56,16 +56,12 @@ cli(["forwards", Name]) ->
             end, emqx_bridge_worker:get_forwards(Name));
 
 cli(["add-forward", Name, Topic]) ->
-    case emqx_bridge_worker:ensure_forward_present(Name, iolist_to_binary(Topic)) of
-        ok -> emqx_ctl:print("Add-forward topic successfully.~n");
-        {error, Reason} -> emqx_ctl:print("Add-forward failed reason: ~p.~n", [Reason])
-    end;
+    ok = emqx_bridge_worker:ensure_forward_present(Name, iolist_to_binary(Topic)),
+    emqx_ctl:print("Add-forward topic successfully.~n");
 
 cli(["del-forward", Name, Topic]) ->
-    case emqx_bridge_worker:ensure_forward_absent(Name, iolist_to_binary(Topic)) of
-        ok -> emqx_ctl:print("Del-forward topic successfully.~n");
-        {error, Reason} -> emqx_ctl:print("Del-forward failed reason: ~p.~n", [Reason])
-    end;
+    ok = emqx_bridge_worker:ensure_forward_absent(Name, iolist_to_binary(Topic)),
+    emqx_ctl:print("Del-forward topic successfully.~n");
 
 cli(["subscriptions", Name]) ->
     foreach(fun({Topic, Qos}) ->
@@ -79,10 +75,8 @@ cli(["add-subscription", Name, Topic, Qos]) ->
     end;
 
 cli(["del-subscription", Name, Topic]) ->
-    case emqx_bridge_worker:ensure_subscription_absent(Name, Topic) of
-        ok -> emqx_ctl:print("Del-subscription topic successfully.~n");
-        {error, Reason} -> emqx_ctl:print("Del-subscription failed reason: ~p.~n", [Reason])
-    end;
+    ok = emqx_bridge_worker:ensure_subscription_absent(Name, Topic),
+    emqx_ctl:print("Del-subscription topic successfully.~n");
 
 cli(_) ->
     emqx_ctl:usage([{"bridges list",           "List bridges"},