diff options
| author | Simon MacMullen <simon@rabbitmq.com> | 2013-07-30 16:46:46 +0100 |
|---|---|---|
| committer | Simon MacMullen <simon@rabbitmq.com> | 2013-07-30 16:46:46 +0100 |
| commit | 86cd6f042b678357c38a1a7653a7bde148a5503d (patch) | |
| tree | 6356589646e995c8308cfec9d253208512a2929e /src | |
| parent | 6371de0dbef8c04b0cda394c8eecdb08bcdd9605 (diff) | |
| download | rabbitmq-server-git-86cd6f042b678357c38a1a7653a7bde148a5503d.tar.gz | |
Pick an apply-to value heuristically.
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_upgrade_functions.erl | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/rabbit_upgrade_functions.erl b/src/rabbit_upgrade_functions.erl index d76002dd19..76bfe28a95 100644 --- a/src/rabbit_upgrade_functions.erl +++ b/src/rabbit_upgrade_functions.erl @@ -305,12 +305,22 @@ policy_apply_to() -> transform( rabbit_runtime_parameters, fun ({runtime_parameters, Key = {_VHost, <<"policy">>, _Name}, Value}) -> - {runtime_parameters, Key, [{<<"apply-to">>, <<"both">>} | Value]}; + ApplyTo = apply_to(proplists:get_value(<<"definition">>, Value)), + {runtime_parameters, Key, [{<<"apply-to">>, ApplyTo} | Value]}; ({runtime_parameters, Key, Value}) -> {runtime_parameters, Key, Value} end, [key, value]). +apply_to(Def) -> + case [proplists:get_value(K, Def) || + K <- [<<"federation-upstream-set">>, <<"ha-mode">>]] of + [undefined, undefined] -> <<"both">>; + [_, undefined] -> <<"exchanges">>; + [undefined, _] -> <<"queues">>; + [_, _] -> <<"both">> + end. + %%-------------------------------------------------------------------- transform(TableName, Fun, FieldList) -> |
