summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2012-10-16 16:16:04 +0100
committerSimon MacMullen <simon@rabbitmq.com>2012-10-16 16:16:04 +0100
commit9402f51a6585e0544d77a0511d176aae69f3f5b4 (patch)
treee63e11b55395155e8e1a256fb3057ba954a08097
parent5eb37c01f3d3cc02d174e36b75a91d754029bd62 (diff)
downloadrabbitmq-server-9402f51a6585e0544d77a0511d176aae69f3f5b4.tar.gz
We call it "set" not "add" everywhere else.
-rw-r--r--src/rabbit_control_main.erl2
-rw-r--r--src/rabbit_policy.erl20
2 files changed, 11 insertions, 11 deletions
diff --git a/src/rabbit_control_main.erl b/src/rabbit_control_main.erl
index 3f3a0b8b..c5ded019 100644
--- a/src/rabbit_control_main.erl
+++ b/src/rabbit_control_main.erl
@@ -470,7 +470,7 @@ action(set_policy, Node, [Key, Pattern, Defn | Prio], Opts, Inform)
end,
VHostArg = list_to_binary(proplists:get_value(?VHOST_OPT, Opts)),
Inform(InformMsg, [Key, Pattern, Defn] ++ Prio),
- rpc_call(Node, rabbit_policy, parse_add,
+ rpc_call(Node, rabbit_policy, parse_set,
[VHostArg, list_to_binary(Key), Pattern, Defn, Prio1]);
action(clear_policy, Node, [Key], Opts, Inform) ->
diff --git a/src/rabbit_policy.erl b/src/rabbit_policy.erl
index c938d1be..4039607a 100644
--- a/src/rabbit_policy.erl
+++ b/src/rabbit_policy.erl
@@ -27,7 +27,7 @@
-export([register/0]).
-export([name/1, get/2, set/1]).
-export([validate/4, validate_clear/3, notify/4, notify_clear/3]).
--export([parse_add/5, add/5, delete/2, lookup/2, list/0, list/1,
+-export([parse_set/5, set/5, delete/2, lookup/2, list/0, list/1,
list_formatted/1, info_keys/0]).
-define(TABLE, rabbit_runtime_parameters).
@@ -69,34 +69,34 @@ get0(Name, List) -> case pget(definition, List) of
%%----------------------------------------------------------------------------
-parse_add(VHost, Key, Pattern, Definition, undefined) ->
- parse_add_policy0(VHost, Key, Pattern, Definition, []);
-parse_add(VHost, Key, Pattern, Definition, Priority) ->
+parse_set(VHost, Key, Pattern, Definition, undefined) ->
+ parse_set0(VHost, Key, Pattern, Definition, []);
+parse_set(VHost, Key, Pattern, Definition, Priority) ->
try list_to_integer(Priority) of
- Num -> parse_add_policy0(VHost, Key, Pattern, Definition,
+ Num -> parse_set0(VHost, Key, Pattern, Definition,
[{<<"priority">>, Num}])
catch
error:badarg -> {error, "~p priority must be a number", [Priority]}
end.
-parse_add_policy0(VHost, Key, Pattern, Defn, Priority) ->
+parse_set0(VHost, Key, Pattern, Defn, Priority) ->
case rabbit_misc:json_decode(Defn) of
{ok, JSON} ->
- add0(VHost, Key, [{<<"pattern">>, list_to_binary(Pattern)},
+ set0(VHost, Key, [{<<"pattern">>, list_to_binary(Pattern)},
{<<"policy">>, rabbit_misc:json_to_term(JSON)}] ++
Priority);
error ->
{error_string, "JSON decoding error"}
end.
-add(VHost, Key, Pattern, Definition, Priority) ->
+set(VHost, Key, Pattern, Definition, Priority) ->
PolicyProps = [{<<"pattern">>, Pattern}, {<<"policy">>, Definition}],
- add0(VHost, Key, case Priority of
+ set0(VHost, Key, case Priority of
undefined -> [];
_ -> [{<<"priority">>, Priority}]
end ++ PolicyProps).
-add0(VHost, Key, Term) ->
+set0(VHost, Key, Term) ->
rabbit_runtime_parameters:set_any(VHost, <<"policy">>, Key, Term).
delete(VHost, Key) ->