summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Klishin <mklishin@pivotal.io>2017-01-20 20:24:00 +0300
committerMichael Klishin <mklishin@pivotal.io>2017-01-20 20:24:00 +0300
commitcfe9829874149d431428217947d97f9c2d2c84a7 (patch)
tree80ce2bf50dd06564cfcefc4f24b062f773aee4d8
parent6bf17f6c6351e019db3df4112d1c33b95bcff705 (diff)
downloadrabbitmq-server-git-cfe9829874149d431428217947d97f9c2d2c84a7.tar.gz
Fall back to ?UNKNOWN_USER if no user is present in options
Sometimes we don't know who the declaring user was: it can be due to an upgrade, because an exchange is built-in, and so on. Per discussion with @dcorbacho.
-rw-r--r--src/rabbit_amqqueue_process.erl2
-rw-r--r--src/rabbit_exchange.erl2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl
index 21dd4db40f..d8b1cbc85b 100644
--- a/src/rabbit_amqqueue_process.erl
+++ b/src/rabbit_amqqueue_process.erl
@@ -963,7 +963,7 @@ i(reductions, _State) ->
{reductions, Reductions} = erlang:process_info(self(), reductions),
Reductions;
i(user_who_performed_action, #q{q = #amqqueue{options = Opts}}) ->
- maps:get(user, Opts);
+ maps:get(user, Opts, ?UNKNOWN_USER);
i(Item, #q{backing_queue_state = BQS, backing_queue = BQ}) ->
BQ:info(Item, BQS).
diff --git a/src/rabbit_exchange.erl b/src/rabbit_exchange.erl
index d5a9afbeca..85f061a17b 100644
--- a/src/rabbit_exchange.erl
+++ b/src/rabbit_exchange.erl
@@ -346,7 +346,7 @@ i(policy, X) -> case rabbit_policy:name(X) of
Policy -> Policy
end;
i(user_who_performed_action, #exchange{options = Opts}) ->
- maps:get(user, Opts);
+ maps:get(user, Opts, ?UNKNOWN_USER);
i(Item, #exchange{type = Type} = X) ->
case (type_to_module(Type)):info(X, [Item]) of
[{Item, I}] -> I;