From ed423cfac2de5210d6e68085e6e15acf2db32476 Mon Sep 17 00:00:00 2001 From: Simon MacMullen Date: Thu, 9 May 2013 12:37:32 +0100 Subject: Validate on list --- src/rabbit_runtime_parameters.erl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/rabbit_runtime_parameters.erl b/src/rabbit_runtime_parameters.erl index d90b7c34..fd0c1915 100644 --- a/src/rabbit_runtime_parameters.erl +++ b/src/rabbit_runtime_parameters.erl @@ -140,6 +140,7 @@ list(VHost) -> list(VHost, '_'). list_component(Component) -> list('_', Component). list(VHost, Component) -> + assert_vhost(VHost), Match = #runtime_parameters{key = {VHost, Component, '_'}, _ = '_'}, [p(P) || #runtime_parameters{key = {_VHost, Comp, _Name}} = P <- mnesia:dirty_match_object(?TABLE, Match), @@ -148,6 +149,12 @@ list(VHost, Component) -> list_formatted(VHost) -> [pset(value, format(pget(value, P)), P) || P <- list(VHost)]. +assert_vhost('_') -> ok; +assert_vhost(VHost) -> case rabbit_vhost:exists(VHost) of + true -> ok; + false -> throw({error, {no_such_vhost, VHost}}) + end. + lookup(VHost, Component, Name) -> case lookup0(VHost, Component, Name, rabbit_misc:const(not_found)) of not_found -> not_found; -- cgit v1.2.1