anchor.diff:      {error, Error} -> err("Error unregistering: ~p", [Error])
     end.
   
  -robust_join_cluster(Node, 0) ->
  -  rabbit_mnesia:join_cluster(Node, disc);
  -robust_join_cluster(Node, Count) ->
  +robust_join_cluster(0) ->
  +  Nodes = cluster_nodes(),
  +  join_cluster(Nodes);
  +robust_join_cluster(Count) ->
     try
  -    rabbit_mnesia:join_cluster(Node, disc)
  +    robust_join_cluster(0)
     catch throw:Reason ->
       warning("Failed to join cluster (~p retries left):~n    ~p", [Count, Reason]),
       timer:sleep(5000),
  -    robust_join_cluster(Node, Count - 1)
  +    robust_join_cluster(Count - 1)
     end.
   
   %% @private
  
positive.code:     false ->
        case register() of
          ok ->
            Nodes = cluster_nodes(10),
            join_cluster(Nodes);
          {error, 400}   ->
            err("Permission denied when registering node with Consul"),
            error;
  
negative.code:   ok;
  join_cluster(Nodes) ->
    info("Joining existing cluster: ~p", [Nodes]),
    Node = lists:nth(random:uniform(length(Nodes)), Nodes),
    info("Chosen node to join to: ~p", [Node]),
    application:stop(rabbit),
    mnesia:stop(),
    rabbit_mnesia:reset(),
    rabbit_mnesia:join_cluster(Node, disc),
    mnesia:start(),
    rabbit:start(),
    info("Cluster joined"),
  