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.
pull/34086/head^2
Michael Tharp 7 years ago committed by René Moser
parent b1a6f1f47b
commit 6dcb41b40f

@ -113,6 +113,8 @@ class RabbitMqPolicy(object):
policies = self._exec(['list_policies'], True) policies = self._exec(['list_policies'], True)
for policy in policies: for policy in policies:
if not policy:
continue
policy_name = policy.split('\t')[1] policy_name = policy.split('\t')[1]
if policy_name == self._name: if policy_name == self._name:
return True return True

Loading…
Cancel
Save