From fcbee7e40baa7403299b3de5cf391eb747ee716f Mon Sep 17 00:00:00 2001 From: Lachlan Cooper Date: Fri, 23 Mar 2018 04:03:20 +1100 Subject: [PATCH] Check that output from list_vhosts can be split (#37630) As with list_users, list_vhosts can sometimes return a value that doesn't contain a '\t' character. This appears to be the case if the server has no vhosts, for example. The same fix was applied to the rabbitmq_users module here: https://github.com/ansible/ansible/commit/fafb89cde58eff5994f607b2dacce880b57bd56d --- lib/ansible/modules/messaging/rabbitmq_vhost.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/ansible/modules/messaging/rabbitmq_vhost.py b/lib/ansible/modules/messaging/rabbitmq_vhost.py index bc85d92ec92..59d8e61a2dc 100644 --- a/lib/ansible/modules/messaging/rabbitmq_vhost.py +++ b/lib/ansible/modules/messaging/rabbitmq_vhost.py @@ -76,6 +76,9 @@ class RabbitMqVhost(object): vhosts = self._exec(['list_vhosts', 'name', 'tracing'], True) for vhost in vhosts: + if '\t' not in vhost: + continue + name, tracing = vhost.split('\t') if name == self.name: self._tracing = self.module.boolean(tracing)