diff options
| author | Alexandru Scvortov <alexandru@rabbitmq.com> | 2011-09-09 14:50:28 +0100 |
|---|---|---|
| committer | Alexandru Scvortov <alexandru@rabbitmq.com> | 2011-09-09 14:50:28 +0100 |
| commit | 5769e15bcdfaabb675d1648640de3a416f0bd053 (patch) | |
| tree | 2f45726d81562c6ea5cbeb6a0bfa1ecdba770e4f /src | |
| parent | 96cb9d5c605eefc6901d9d8929d02bd74cc5ea27 (diff) | |
| download | rabbitmq-server-git-5769e15bcdfaabb675d1648640de3a416f0bd053.tar.gz | |
handle invalid plugins
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_plugin.erl | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/rabbit_plugin.erl b/src/rabbit_plugin.erl index 2547f7816b..d5539912ef 100644 --- a/src/rabbit_plugin.erl +++ b/src/rabbit_plugin.erl @@ -83,7 +83,19 @@ action(list, [], _Opts, PluginsDir, PluginsDistDir) -> find_available_plugins(PluginsDistDir) -> EZs = filelib:wildcard("*.ez", PluginsDistDir), - [get_plugin_info(filename:join([PluginsDistDir, EZ])) || EZ <- EZs]. + {Plugins, Problems} = + lists:foldl(fun ({error, EZ, Reason}, {Plugins1, Problems1}) -> + {Plugins1, [{EZ, Reason} | Problems1]}; + (Plugin = #plugin{}, {Plugins1, Problems1}) -> + {[Plugin|Plugins1], Problems1} + end, {[], []}, + [get_plugin_info(filename:join([PluginsDistDir, EZ])) + || EZ <- EZs]), + case Problems of + [] -> ok; + _ -> io:format("Warning: Problem reading some plugins: ~p~n", [Problems]) + end, + Plugins. get_plugin_info(EZ) -> case read_app_file(EZ) of @@ -93,8 +105,8 @@ get_plugin_info(EZ) -> Dependencies = proplists:get_value(applications, Props, []), #plugin{name = Name, version = Version, description = Description, dependencies = Dependencies, location = EZ}; - {error, _} = Error -> - Error + {error, Reason} -> + {error, EZ, Reason} end. %% Read the .app file from an ez. |
