summaryrefslogtreecommitdiff
path: root/src/rabbit_control_main.erl
diff options
context:
space:
mode:
authorEmile Joubert <emile@rabbitmq.com>2012-10-02 10:17:17 +0100
committerEmile Joubert <emile@rabbitmq.com>2012-10-02 10:17:17 +0100
commitce8c17a472b3480b1bafb9c1683367e998688487 (patch)
treea9ff5d9c8db97a979e07ade88ae38b9b49eb72ef /src/rabbit_control_main.erl
parent8494b83766c2d310e631d95fc15916fb18e60ad2 (diff)
downloadrabbitmq-server-ce8c17a472b3480b1bafb9c1683367e998688487.tar.gz
First draft of policy validation
Diffstat (limited to 'src/rabbit_control_main.erl')
-rw-r--r--src/rabbit_control_main.erl24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/rabbit_control_main.erl b/src/rabbit_control_main.erl
index e75e1f6f..1efde136 100644
--- a/src/rabbit_control_main.erl
+++ b/src/rabbit_control_main.erl
@@ -70,6 +70,10 @@
{clear_parameter, [?VHOST_DEF]},
{list_parameters, [?VHOST_DEF]},
+ {set_policy, [?VHOST_DEF]},
+ {clear_policy, [?VHOST_DEF]},
+ {list_policies, [?VHOST_DEF]},
+
{list_queues, [?VHOST_DEF]},
{list_exchanges, [?VHOST_DEF]},
{list_bindings, [?VHOST_DEF]},
@@ -458,6 +462,26 @@ action(list_parameters, Node, [], Opts, Inform) ->
rpc_call(Node, rabbit_runtime_parameters, list_formatted, [VHostArg]),
rabbit_runtime_parameters:info_keys());
+action(set_policy, Node, [Key, Value], Opts, Inform) ->
+ VHostArg = list_to_binary(proplists:get_value(?VHOST_OPT, Opts)),
+ Inform("Setting policy ~p to ~p", [Key, Value]),
+ rpc_call(Node, rabbit_runtime_parameters, parse_set,
+ [VHostArg, <<"policy">>, list_to_binary(Key), Value]);
+
+action(clear_policy, Node, [Key], Opts, Inform) ->
+ VHostArg = list_to_binary(proplists:get_value(?VHOST_OPT, Opts)),
+ Inform("Clearing policy ~p", [Key]),
+ rpc_call(Node, rabbit_runtime_parameters, clear, [VHostArg,
+ <<"policy">>,
+ list_to_binary(Key)]);
+
+action(list_policies, Node, [], Opts, Inform) ->
+ VHostArg = list_to_binary(proplists:get_value(?VHOST_OPT, Opts)),
+ Inform("Listing policies", []),
+ display_info_list(
+ rpc_call(Node, rabbit_runtime_parameters, list_formatted_policies, [VHostArg]),
+ rabbit_runtime_parameters:info_keys() -- [component]);
+
action(report, Node, _Args, _Opts, Inform) ->
Inform("Reporting server status on ~p~n~n", [erlang:universaltime()]),
[begin ok = action(Action, N, [], [], Inform), io:nl() end ||