Merge remote-tracking branch 'origin/riak/2.0' into bch-merge-2.0-onto-develop-2.2

This commit is contained in:
Brett Hazen 2016-05-03 11:36:36 -06:00
commit 8abe51a59f

View File

@ -143,6 +143,7 @@
upgrade/2,
upgrade/3,
versions/0,
wait_for_any_webmachine_route/2,
wait_for_cluster_service/2,
wait_for_cmd/1,
wait_for_service/2,
@ -1932,19 +1933,18 @@ wait_for_control(_Vsn, Node) when is_atom(Node) ->
end
end),
lager:info("Waiting for routes to be added to supervisor..."),
%% Wait for routes to be added by supervisor.
wait_for_any_webmachine_route(Node, [admin_gui, riak_control_wm_gui]).
wait_for_any_webmachine_route(Node, Routes) ->
lager:info("Waiting for routes ~p to be added to webmachine.", [Routes]),
rt:wait_until(Node, fun(N) ->
case rpc:call(N,
webmachine_router,
get_routes,
[]) of
case rpc:call(N, webmachine_router, get_routes, []) of
{badrpc, Error} ->
lager:info("Error was ~p.", [Error]),
false;
Routes ->
case is_control_gui_route_loaded(Routes) of
RegisteredRoutes ->
case is_any_route_loaded(Routes, RegisteredRoutes) of
false ->
false;
_ ->
@ -1953,9 +1953,11 @@ wait_for_control(_Vsn, Node) when is_atom(Node) ->
end
end).
%% @doc Is the riak_control GUI route loaded?
is_control_gui_route_loaded(Routes) ->
lists:keymember(admin_gui, 2, Routes) orelse lists:keymember(riak_control_wm_gui, 2, Routes).
is_any_route_loaded(SearchRoutes, RegisteredRoutes) ->
lists:any(fun(Route) -> is_route_loaded(Route, RegisteredRoutes) end, SearchRoutes).
is_route_loaded(Route, Routes) ->
lists:keymember(Route, 2, Routes).
%% @doc Wait for Riak Control to start on a series of nodes.
wait_for_control(VersionedNodes) when is_list(VersionedNodes) ->