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:
fafb89cde5
This commit is contained in:
Lachlan Cooper 2018-03-23 04:03:20 +11:00 committed by Sam Doran
parent 6ad784bbbb
commit fcbee7e40b

View file

@ -76,6 +76,9 @@ class RabbitMqVhost(object):
vhosts = self._exec(['list_vhosts', 'name', 'tracing'], True) vhosts = self._exec(['list_vhosts', 'name', 'tracing'], True)
for vhost in vhosts: for vhost in vhosts:
if '\t' not in vhost:
continue
name, tracing = vhost.split('\t') name, tracing = vhost.split('\t')
if name == self.name: if name == self.name:
self._tracing = self.module.boolean(tracing) self._tracing = self.module.boolean(tracing)