Skip to content

Commit 53d4c82

Browse files
author
Daniil Fedotov
committed
Check that rabbit application is running when trying to enable plugins.
If the node is started, but rabbit application is not running, plugins can fail to start when enabled. Check for rabbit application and return an error. Part of #rabbitmq/rabbimq-cli#226 [#153184802]
1 parent ff8f76d commit 53d4c82

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/rabbit_plugins.erl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,13 @@
4444

4545
%%----------------------------------------------------------------------------
4646

47-
ensure(FileJustChanged0) ->
47+
ensure(FileJustChanged) ->
48+
case rabbit:is_running() of
49+
true -> ensure1(FileJustChanged);
50+
false -> {error, rabbit_not_running}
51+
end.
52+
53+
ensure1(FileJustChanged0) ->
4854
{ok, OurFile0} = application:get_env(rabbit, enabled_plugins_file),
4955
FileJustChanged = filename:nativename(FileJustChanged0),
5056
OurFile = filename:nativename(OurFile0),

0 commit comments

Comments
 (0)