Fix rabbitmq_user when using force on user with permissions (#41361)

On rabbitmq 3.7 using `force: yes` fails because outputs of rabbitmqctl gives an empty line

```
root@rabbitmq-vm1:~# rabbitmqctl -q list_user_permissions john

root@rabbitmq-vm1:~#
```

Provoking an error on

456af458fc/lib/ansible/modules/messaging/rabbitmq_user.py (L185)

Because `perm.split('\t')` does not find any `\t`

Signed-off-by: Sylvain Rabot <s.rabot@lectra.com>
(cherry picked from commit 8ddca3e6cfd906f0ff48a2c08410a9f82d195deb)
This commit is contained in:
Sylvain Rabot 2018-06-14 18:52:01 +02:00 committed by Matt Davis
parent d9c5614b92
commit c54990fd81

View file

@ -152,7 +152,7 @@ class RabbitMqUser(object):
if self.node is not None:
cmd.extend(['-n', self.node])
rc, out, err = self.module.run_command(cmd + args, check_rc=True)
return out.splitlines()
return out.splitlines() if len(out.strip()) else []
return list()
def get(self):