summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerhard Lazu <gerhard@rabbitmq.com>2016-12-19 12:39:57 +0000
committerJean-Sébastien Pedron <jean-sebastien@rabbitmq.com>2016-12-19 12:39:57 +0000
commit76a8c66c8092cc1c37bb4aa90a0a3d18b27f7d9d (patch)
tree0987bf086de5243cf32f8839428d5e85e647f676
parent7069f3b40daeb5095077bdac19f3837978bc2665 (diff)
downloadrabbitmq-server-git-76a8c66c8092cc1c37bb4aa90a0a3d18b27f7d9d.tar.gz
Optionally cleanup the old plugins expand dir
Signed-off-by: Jean-Sébastien Pedron <jean-sebastien@rabbitmq.com> [#118562759]
-rw-r--r--src/rabbit_plugins.erl23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/rabbit_plugins.erl b/src/rabbit_plugins.erl
index c995acd2b0..858ef6d49a 100644
--- a/src/rabbit_plugins.erl
+++ b/src/rabbit_plugins.erl
@@ -67,15 +67,22 @@ ensure(FileJustChanged0) ->
{error, {enabled_plugins_mismatch, FileJustChanged, OurFile}}
end.
-%% @doc Prepares the file system and installs all enabled plugins.
setup() ->
- {ok, ExpandDir} = application:get_env(rabbit, plugins_expand_dir),
-
- %% Eliminate the contents of the destination directory
- case delete_recursively(ExpandDir) of
- ok -> ok;
- {error, E1} -> throw({error, {cannot_delete_plugins_expand_dir,
- [ExpandDir, E1]}})
+ case application:get_env(rabbit, plugins_expand_dir) of
+ {ok, ExpandDir} ->
+ case filelib:is_dir(ExpandDir) of
+ true ->
+ rabbit_log:info(
+ "\"~s\" is no longer used to expand plugins.~n"
+ "RabbitMQ still manages this directory "
+ "but will stop doing so in the future.", [ExpandDir]),
+
+ _ = delete_recursively(ExpandDir);
+ false ->
+ ok
+ end;
+ undefined ->
+ ok
end,
{ok, EnabledFile} = application:get_env(rabbit, enabled_plugins_file),