From eb6a2408db26b70f5f5299460a5fc57dae4896f1 Mon Sep 17 00:00:00 2001 From: cadl42 Date: Tue, 2 Oct 2018 17:38:50 +0800 Subject: [PATCH] Ignore empty result of rabbitmqctl list_user_permissions (#35598) Fix #34863 (cherry picked from commit a7221dd28976f0734b081b0f5c501e93aaa9c2b7) --- changelogs/fragments/34863-rabbitmq_user_unpack_fix.yaml | 2 ++ lib/ansible/modules/messaging/rabbitmq_user.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/34863-rabbitmq_user_unpack_fix.yaml diff --git a/changelogs/fragments/34863-rabbitmq_user_unpack_fix.yaml b/changelogs/fragments/34863-rabbitmq_user_unpack_fix.yaml new file mode 100644 index 0000000000..b97b0b18ad --- /dev/null +++ b/changelogs/fragments/34863-rabbitmq_user_unpack_fix.yaml @@ -0,0 +1,2 @@ +bugfixes: +- Ignore empty result of rabbitmqctl list_user_permissions. diff --git a/lib/ansible/modules/messaging/rabbitmq_user.py b/lib/ansible/modules/messaging/rabbitmq_user.py index 6d87d7626f..952a7f6bcc 100644 --- a/lib/ansible/modules/messaging/rabbitmq_user.py +++ b/lib/ansible/modules/messaging/rabbitmq_user.py @@ -172,7 +172,7 @@ class RabbitMqUser(object): return False def _get_permissions(self): - perms_out = self._exec(['list_user_permissions', self.username], True) + perms_out = [perm for perm in self._exec(['list_user_permissions', self.username], True) if perm.strip()] perms_list = list() for perm in perms_out: