diff options
author | Matthias Radestock <matthias@rabbitmq.com> | 2012-08-08 05:50:20 +0100 |
---|---|---|
committer | Matthias Radestock <matthias@rabbitmq.com> | 2012-08-08 05:50:20 +0100 |
commit | ab67df9c62f7868e2157bcf88adfc235d941fffe (patch) | |
tree | f83dc73aca43f630a5de3f03bdccb1eb9ce5f909 | |
parent | e5c00753ace4dfe553aaeb160d7fecb9bc001c98 (diff) | |
parent | 6c459693325c44d0b5a8a2adfa6d8afdbd3370f0 (diff) | |
download | rabbitmq-server-ab67df9c62f7868e2157bcf88adfc235d941fffe.tar.gz |
merge default into bug24719
-rw-r--r-- | src/rabbit_log.erl | 10 | ||||
-rw-r--r-- | src/rabbit_misc.erl | 9 | ||||
-rw-r--r-- | src/rabbit_plugins.erl | 49 |
3 files changed, 32 insertions, 36 deletions
diff --git a/src/rabbit_log.erl b/src/rabbit_log.erl index a6b4eeb0..8dfa89d3 100644 --- a/src/rabbit_log.erl +++ b/src/rabbit_log.erl @@ -40,18 +40,20 @@ -spec(log/3 :: (category(), level(), string()) -> 'ok'). -spec(log/4 :: (category(), level(), string(), [any()]) -> 'ok'). --spec(info/1 :: (string()) -> 'ok'). --spec(info/2 :: (string(), [any()]) -> 'ok'). + +-spec(info/1 :: (string()) -> 'ok'). +-spec(info/2 :: (string(), [any()]) -> 'ok'). -spec(warning/1 :: (string()) -> 'ok'). -spec(warning/2 :: (string(), [any()]) -> 'ok'). --spec(error/1 :: (string()) -> 'ok'). --spec(error/2 :: (string(), [any()]) -> 'ok'). +-spec(error/1 :: (string()) -> 'ok'). +-spec(error/2 :: (string(), [any()]) -> 'ok'). -endif. %%---------------------------------------------------------------------------- start_link() -> gen_server:start_link({local, ?SERVER}, ?MODULE, [], []). + log(Category, Level, Fmt) -> log(Category, Level, Fmt, []). log(Category, Level, Fmt, Args) when is_list(Args) -> diff --git a/src/rabbit_misc.erl b/src/rabbit_misc.erl index 25a51d22..5eb24327 100644 --- a/src/rabbit_misc.erl +++ b/src/rabbit_misc.erl @@ -396,19 +396,16 @@ report_coverage_percentage(File, Cov, NotCov, Mod) -> confirm_to_sender(Pid, MsgSeqNos) -> gen_server2:cast(Pid, {confirm, MsgSeqNos, self()}). -%% -%% @doc Halts the emulator after printing out an error message io-formatted with -%% the supplied arguments. The exit status of the beam process will be set to 1. -%% +%% @doc Halts the emulator after printing out an error message +%% io-formatted with the supplied arguments. The exit status of the +%% beam process will be set to 1. quit(Fmt, Args) -> io:format("ERROR: " ++ Fmt ++ "~n", Args), quit(1). -%% %% @doc Halts the emulator returning the given status code to the os. %% On Windows this function will block indefinitely so as to give the io %% subsystem time to flush stdout completely. -%% quit(Status) -> case os:type() of {unix, _} -> halt(Status); diff --git a/src/rabbit_plugins.erl b/src/rabbit_plugins.erl index 514c5ed9..9d2d19a0 100644 --- a/src/rabbit_plugins.erl +++ b/src/rabbit_plugins.erl @@ -47,13 +47,12 @@ %% @doc Prepares the file system and installs all enabled plugins. setup() -> - {ok, PluginDir} = application:get_env(rabbit, plugins_dir), - {ok, ExpandDir} = application:get_env(rabbit, plugins_expand_dir), - {ok, EnabledPluginsFile} = application:get_env(rabbit, - enabled_plugins_file), - prepare_plugins(EnabledPluginsFile, PluginDir, ExpandDir), + {ok, PluginDir} = application:get_env(rabbit, plugins_dir), + {ok, ExpandDir} = application:get_env(rabbit, plugins_expand_dir), + {ok, EnabledFile} = application:get_env(rabbit, enabled_plugins_file), + prepare_plugins(EnabledFile, PluginDir, ExpandDir), [prepare_dir_plugin(PluginName) || - PluginName <- filelib:wildcard(ExpandDir ++ "/*/ebin/*.app")]. + PluginName <- filelib:wildcard("*/ebin/*.app", ExpandDir)]. %% @doc Lists the plugins which are currently running. active() -> @@ -123,32 +122,31 @@ dependencies(Reverse, Sources, AllPlugins) -> %%---------------------------------------------------------------------------- -prepare_plugins(EnabledPluginsFile, PluginsDistDir, DestDir) -> +prepare_plugins(EnabledFile, PluginsDistDir, ExpandDir) -> AllPlugins = list(PluginsDistDir), - Enabled = read_enabled(EnabledPluginsFile), + Enabled = read_enabled(EnabledFile), ToUnpack = dependencies(false, Enabled, AllPlugins), ToUnpackPlugins = lookup_plugins(ToUnpack, AllPlugins), - Missing = Enabled -- plugin_names(ToUnpackPlugins), - case Missing of - [] -> ok; - _ -> io:format("Warning: the following enabled plugins were " - "not found: ~p~n", [Missing]) + case Enabled -- plugin_names(ToUnpackPlugins) of + [] -> ok; + Missing -> io:format("Warning: the following enabled plugins were " + "not found: ~p~n", [Missing]) end, %% Eliminate the contents of the destination directory - case delete_recursively(DestDir) of + case delete_recursively(ExpandDir) of ok -> ok; - {error, E} -> rabbit_misc:quit("Could not delete dir ~s (~p)", - [DestDir, E]) + {error, E} -> throw({error, {cannot_delete_plugins_expand_dir, + [ExpandDir, E]}}) end, - case filelib:ensure_dir(DestDir ++ "/") of - ok -> ok; - {error, E2} -> rabbit_misc:quit("Could not create dir ~s (~p)", - [DestDir, E2]) + case filelib:ensure_dir(ExpandDir ++ "/") of + ok -> ok; + {error, E} -> throw({error, {cannot_create_plugins_expand_dir, + [ExpandDir, E]}}) end, - [prepare_plugin(Plugin, DestDir) || Plugin <- ToUnpackPlugins]. + [prepare_plugin(Plugin, ExpandDir) || Plugin <- ToUnpackPlugins]. prepare_dir_plugin(PluginAppDescFn) -> %% Add the plugin ebin directory to the load path @@ -169,12 +167,11 @@ delete_recursively(Fn) -> Error -> Error end. -prepare_plugin(#plugin{type = ez, location = Location}, PluginDestDir) -> - zip:unzip(Location, [{cwd, PluginDestDir}]); +prepare_plugin(#plugin{type = ez, location = Location}, ExpandDir) -> + zip:unzip(Location, [{cwd, ExpandDir}]); prepare_plugin(#plugin{type = dir, name = Name, location = Location}, - PluginsDestDir) -> - rabbit_file:recursive_copy(Location, - filename:join([PluginsDestDir, Name])). + ExpandDir) -> + rabbit_file:recursive_copy(Location, filename:join([ExpandDir, Name])). get_plugin_info(Base, {ez, EZ0}) -> EZ = filename:join([Base, EZ0]), |