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
commitb6e87d7cd2245dd75d9fb3d6cdaaa7a5792b9908 (patch)
treeac6b019353f68cff0e59d549432b5487077f471e
parent3c717c4ed24f7d0b398f46edaf4cbb457a1dcdac (diff)
downloadrabbitmq-server-git-b6e87d7cd2245dd75d9fb3d6cdaaa7a5792b9908.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 0552017031..a9427ab48f 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"};