summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2013-05-08 17:08:57 +0100
committerSimon MacMullen <simon@rabbitmq.com>2013-05-08 17:08:57 +0100
commitdbaf442742bd673d4ee4ac98cfd7ffe760ba68a2 (patch)
treeac6b019353f68cff0e59d549432b5487077f471e
parent8b560d061e9dd8872261a393d5987fb92173d8a1 (diff)
downloadrabbitmq-server-dbaf442742bd673d4ee4ac98cfd7ffe760ba68a2.tar.gz
Wrap the update in rabbit_vhost:with/2, so we error meaningfully if the vhost in question does not exist.
-rw-r--r--src/rabbit_runtime_parameters.erl20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/rabbit_runtime_parameters.erl b/src/rabbit_runtime_parameters.erl
index 05520170..a9427ab4 100644
--- a/src/rabbit_runtime_parameters.erl
+++ b/src/rabbit_runtime_parameters.erl
@@ -100,16 +100,16 @@ set_any0(VHost, Component, Name, Term) ->
E
end.
-mnesia_update(VHost, Component, Name, Term) ->
- rabbit_misc:execute_mnesia_transaction(
- fun () ->
- Res = case mnesia:read(?TABLE, {VHost, Component, Name}, read) of
- [] -> new;
- [Params] -> {old, Params#runtime_parameters.value}
- end,
- ok = mnesia:write(?TABLE, c(VHost, Component, Name, Term), write),
- Res
- end).
+mnesia_update(VHost, Comp, Name, Term) ->
+ F = fun () ->
+ Res = case mnesia:read(?TABLE, {VHost, Comp, Name}, read) of
+ [] -> new;
+ [Params] -> {old, Params#runtime_parameters.value}
+ end,
+ ok = mnesia:write(?TABLE, c(VHost, Comp, Name, Term), write),
+ Res
+ end,
+ rabbit_misc:execute_mnesia_transaction(rabbit_vhost:with(VHost, F)).
clear(_, <<"policy">> , _) ->
{error_string, "policies may not be cleared using this method"};