From 6dcb41b40f3c93c708f6452ba52738970c6c5ea6 Mon Sep 17 00:00:00 2001 From: Michael Tharp Date: Fri, 26 Jan 2018 16:00:53 -0500 Subject: [PATCH] rabbitmq_policy: fix IndexError when no policies exist yet (#33556) If the list of existing policies is empty, an IndexError would be raised since stdout was blank. --- lib/ansible/modules/messaging/rabbitmq_policy.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/ansible/modules/messaging/rabbitmq_policy.py b/lib/ansible/modules/messaging/rabbitmq_policy.py index 0d8c56e326a..2480725b1bf 100644 --- a/lib/ansible/modules/messaging/rabbitmq_policy.py +++ b/lib/ansible/modules/messaging/rabbitmq_policy.py @@ -113,6 +113,8 @@ class RabbitMqPolicy(object): policies = self._exec(['list_policies'], True) for policy in policies: + if not policy: + continue policy_name = policy.split('\t')[1] if policy_name == self._name: return True