summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmile Joubert <emile@rabbitmq.com>2012-10-12 16:43:10 +0100
committerEmile Joubert <emile@rabbitmq.com>2012-10-12 16:43:10 +0100
commit948ed9e6f471468f7487c67fcc54b3261673e414 (patch)
tree79c0c4187ce282e1b1b4c8513c12db90b4b83f08
parentcb49b58057ad6d75573a7409b118bf141f9b6b43 (diff)
downloadrabbitmq-server-948ed9e6f471468f7487c67fcc54b3261673e414.tar.gz
Delete policies with vhosts
-rw-r--r--src/rabbit_runtime_parameters.erl6
-rw-r--r--src/rabbit_vhost.erl4
2 files changed, 7 insertions, 3 deletions
diff --git a/src/rabbit_runtime_parameters.erl b/src/rabbit_runtime_parameters.erl
index 564ffeea..138b46ad 100644
--- a/src/rabbit_runtime_parameters.erl
+++ b/src/rabbit_runtime_parameters.erl
@@ -206,13 +206,13 @@ list_param_strict(Component) -> list_param('_', Component, not_found).
list_param(VHost, Component) -> list_param(VHost, Component, []).
list_param_strict(VHost, Component) -> list_param(VHost, Component, not_found).
-list_param(_VHost, <<"policy">>, _Default) ->
- {error, "policies may not be listed using this method"};
list_param(VHost, Component, Default) ->
case component_good(Component) of
true -> Match = #runtime_parameters{key = {VHost, Component, '_'},
_ = '_'},
- [p(P) || P <- mnesia:dirty_match_object(?TABLE, Match)];
+ [p(P) || #runtime_parameters{ key = {_VHost, Comp, _Key}} = P <-
+ mnesia:dirty_match_object(?TABLE, Match),
+ Comp /= <<"policy">>];
_ -> Default
end.
diff --git a/src/rabbit_vhost.erl b/src/rabbit_vhost.erl
index f29f0104..9beedc51 100644
--- a/src/rabbit_vhost.erl
+++ b/src/rabbit_vhost.erl
@@ -98,6 +98,10 @@ internal_delete(VHostPath) ->
proplists:get_value(component, Info),
proplists:get_value(key, Info))
|| Info <- rabbit_runtime_parameters:list_param(VHostPath)],
+ [ok = rabbit_runtime_parameters:clear_policy(
+ VHostPath,
+ proplists:get_value(key, Info))
+ || Info <- rabbit_runtime_parameters:list_policies(VHostPath)],
ok = mnesia:delete({rabbit_vhost, VHostPath}),
ok.