Added checks for installed riak versions

This commit is contained in:
Joe DeVivo 2012-08-29 12:10:24 -07:00
parent 3e5e850afe
commit 06b74f9291
2 changed files with 11 additions and 1 deletions

View File

@ -19,7 +19,6 @@ cli_options() ->
main(Args) ->
%% @todo Fail cleanly if version of riak unavailable (e.g. 0.14.2)
%% @todo loaded_upgrade basho_bench polution
{ok, {ParsedArgs, HarnessArgs}} = getopt:parse(cli_options(), Args),

View File

@ -111,6 +111,9 @@ deploy_nodes(NodeConfig) ->
NodeMap = orddict:from_list(lists:zip(Nodes, NodesN)),
{Versions, Configs} = lists:unzip(NodeConfig),
VersionMap = lists:zip(NodesN, Versions),
%% Check that you have the right versions available
[ check_node(Version) || Version <- VersionMap ],
rt:set_config(rt_nodes, NodeMap),
rt:set_config(rt_versions, VersionMap),
@ -243,3 +246,11 @@ get_cmd_result(Port, Acc) ->
after 0 ->
timeout
end.
check_node({_N, Version}) ->
case proplists:is_defined(Version, rt:config(rtdev_path)) of
true -> ok;
_ ->
lager:error("You don't have Riak ~s installed", [Version]),
erlang:error("You don't have Riak " ++ Version ++ " installed" )
end.