Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
add finish cluster routine
  • Loading branch information
janl committed Nov 7, 2014
1 parent fc39fab commit 354647bfaef652113ad033763658a42c45ba03d6
Showing 2 changed files with 14 additions and 12 deletions.
@@ -46,12 +46,12 @@ is_cluster_enabled() ->
has_cluster_system_dbs() ->
% GET /_users /_replicator /_cassim

Users = fabric:get_db_info("_users"),
Replicator = fabric:get_db_info("_replicator"),
Cassim = fabric:get_db_info("_cassim"),
case {Users, Replicator, Cassim} of
case catch {
fabric:get_db_info("_users"),
fabric:get_db_info("_replicator"),
fabric:get_db_info("_cassim")} of
{{ok, _}, {ok, _}, {ok, _}} -> ok;
_Else -> no
_ -> no
end.

enable_cluster(Options) ->
@@ -101,12 +101,12 @@ enable_cluster_int(Options, no) ->

finish_cluster() ->
finish_cluster_int(has_cluster_system_dbs()).
finish_cluster_int(no) ->
{error, cluster_finished};
finish_cluster_int(ok) ->
io:format("~nFinish Cluster~n").
{error, cluster_finished};
finish_cluster_int(no) ->
% create clustered databases (_users, _replicator, _cassim/_metadata
% am I in enabled mode, are there nodes?
Databases = ["_users", "_replicator", "_cassim"],
lists:foreach(fun fabric:create_db/1, Databases).


add_node(Options) ->
@@ -52,11 +52,13 @@ handle_action("enable_cluster", Setup) ->


handle_action("finish_cluster", Setup) ->
io:format("~nfinish_cluster: ~p~n", [Setup]),
case etup:finish_cluster() of
io:format("~nffinish_cluster: ~p~n", [Setup]),
case setup:finish_cluster() of
{error, cluster_finished} ->
{error, <<"Cluster is already finished">>};
_ -> ok
Else ->
io:format("~nElse: ~p~n", [Else]),
ok
end;

handle_action("add_node", Setup) ->

0 comments on commit 354647b

Please sign in to comment.