diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2012-10-22 12:14:49 +0100 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2012-10-22 12:14:49 +0100 |
commit | 3cd89a4583d5e06d8a6cd08f50512736aa66e96b (patch) | |
tree | e874e1a352c940c74db1de8b7dcdb73595fbb62e | |
parent | e47b703be707e44e951c18ef4956681e1479c29c (diff) | |
download | rabbitmq-server-3cd89a4583d5e06d8a6cd08f50512736aa66e96b.tar.gz |
Cosmetic + show non-string nodes params + display "none" when params missing.
-rw-r--r-- | src/rabbit_mirror_queue_misc.erl | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/rabbit_mirror_queue_misc.erl b/src/rabbit_mirror_queue_misc.erl index 187388a5..4a00846e 100644 --- a/src/rabbit_mirror_queue_misc.erl +++ b/src/rabbit_mirror_queue_misc.erl @@ -344,9 +344,9 @@ update_mirrors0(OldQ = #amqqueue{name = QName}, validate_policy(KeyList) -> validate_policy( proplists:get_value(<<"ha-mode">>, KeyList), - proplists:get_value(<<"ha-params">>, KeyList)). + proplists:get_value(<<"ha-params">>, KeyList, none)). -validate_policy(<<"all">>, undefined) -> +validate_policy(<<"all">>, none) -> ok; validate_policy(<<"all">>, _Params) -> {error, "ha-mode=\"all\" does not take parameters", []}; @@ -355,8 +355,9 @@ validate_policy(<<"nodes">>, []) -> {error, "ha-mode=\"nodes\" list must be non-empty", []}; validate_policy(<<"nodes">>, Nodes) when is_list(Nodes) -> case [I || I <- Nodes, not is_binary(I)] of - [] -> ok; - _ -> {error, "ha-mode=\"nodes\" takes a list of strings", []} + [] -> ok; + Invalid -> {error, "ha-mode=\"nodes\" takes a list of strings, " + "~p was not a string", [Invalid]} end; validate_policy(<<"nodes">>, Params) -> {error, "ha-mode=\"nodes\" takes a list, ~p given", [Params]}; @@ -365,6 +366,7 @@ validate_policy(<<"exactly">>, N) when is_integer(N) andalso N > 0 -> ok; validate_policy(<<"exactly">>, Params) -> {error, "ha-mode=\"exactly\" takes an integer, ~p given", [Params]}; + validate_policy(Mode, _Params) -> {error, "~p is not a valid ha-mode value", [Mode]}. |