Skip to content

Commit

Permalink
rabbitmq_policy: fix IndexError when no policies exist yet (ansible#3…
Browse files Browse the repository at this point in the history
…3556)

If the list of existing policies is empty, an IndexError would be raised
since stdout was blank.
  • Loading branch information
mtharp authored and resmo committed Jan 26, 2018
1 parent b1a6f1f commit 6dcb41b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/ansible/modules/messaging/rabbitmq_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ def list(self):
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
Expand Down

0 comments on commit 6dcb41b

Please sign in to comment.