Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'plugins reload <Name>' CLI #30

Merged
merged 5 commits into from Jan 25, 2019

Conversation

@turtleDeng
Copy link
Contributor

turtleDeng commented Jan 24, 2019

No description provided.

@@ -327,6 +327,26 @@ plugins(["unload", Name]) ->
emqx_cli:print("unload plugin error: ~p~n", [Reason])
end;

plugins(["reload", Name]) ->
try
Plugin = list_to_atom(Name),

This comment has been minimized.

Copy link
@emqplus

emqplus Jan 24, 2019

Contributor

list_to_existing_atom(Name) to avoid atom leak

{error, Reason} ->
emqx_cli:print("reload plugin error: ~p~n", [Reason])
end
catch _:_:Error ->

This comment has been minimized.

Copy link
@emqplus

emqplus Jan 24, 2019

Contributor

Should be _:Error:Stacktrace

This comment has been minimized.

Copy link
@gilbertwong96

gilbertwong96 Jan 24, 2019

Contributor

I suppose that it should be _Error : _Reason : Stacktrace

emqx_cli:print("reload plugin error: ~p~n", [Reason])
end
catch _:_:Error ->
emqx_cli:print("reload plugin error:~p~n", [Error])

This comment has been minimized.

Copy link
@emqplus

emqplus Jan 24, 2019

Contributor

emqx_cli:print("reload plugin error:pn~p", [Error, Stacktrace])

@@ -771,3 +792,9 @@ format(_, Val) ->
Val.

bin(S) -> iolist_to_binary(S).

gen_config(App) ->
Schema = cuttlefish_schema:files([lists:concat([code:priv_dir(App), "/", App, ".schema"])]),

This comment has been minimized.

Copy link
@emqplus

emqplus Jan 24, 2019

Contributor

filename:join to replace lists:concat


gen_config(App) ->
Schema = cuttlefish_schema:files([lists:concat([code:priv_dir(App), "/", App, ".schema"])]),
Conf = cuttlefish_conf:file(lists:concat([emqx_config:get_env(plugins_etc_dir), App, ".conf"])),

This comment has been minimized.

Copy link
@emqplus

emqplus Jan 24, 2019

Contributor

filename:join to replace lists:concat

@emqplus emqplus changed the title Reload plugins cmd Add 'reload <Plugin>' CLI Jan 24, 2019
@emqplus emqplus changed the title Add 'reload <Plugin>' CLI Add 'plugins reload <Name>' CLI Jan 24, 2019
@turtleDeng turtleDeng merged commit 2456bce into emqx30 Jan 25, 2019
@turtleDeng turtleDeng deleted the reload_plugins branch Jan 25, 2019
turtleDeng added a commit that referenced this pull request Jan 25, 2019
* Add 'plugins reload <Name>' CLI (#30)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.