anchor.diff:      false ->
         case register() of
           ok ->
  -          Nodes = cluster_nodes(10),
  -          join_cluster(Nodes);
  +          robust_join_cluster(50);
           {error, 400}   ->
             err("Permission denied when registering node with Consul"),
             error;
  
positive.code:   ok;
  join_cluster(Nodes) ->
    info("Joining existing cluster: ~p", [Nodes]),
    application:stop(rabbit),
    mnesia:stop(),
    rabbit_mnesia:reset(),
    robust_join_cluster(lists:nth(1, Nodes), 10),
    mnesia:start(),
    rabbit:start(),
    info("Cluster joined"),
  
negative.code:     {error, Error} -> err("Error unregistering: ~p", [Error])
    end.
  
  robust_join_cluster(0) ->
    Nodes = cluster_nodes(),
    join_cluster(Nodes);
  robust_join_cluster(Count) ->
    try
      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(Count - 1)
    end.
  
  %% @private
  