Ansible-runner is failing when passing host to display

Ansible-runner is using their own custom call back and it appears to be
failing when actually set to a non-string. Check to make sure host is a
string or just unset it if it isn't a string value.

Change-Id: Ib67b6bd69ed1c3f9fcd32552b6599cbe4ff478ce
Closes-Bug: #1904917
(cherry picked from commit e737f3bfd4)
This commit is contained in:
Alex Schultz 2020-11-19 13:35:36 -07:00
parent 83c644c9ed
commit ddb9af5fb3
2 changed files with 4 additions and 1 deletions

View File

@ -53,6 +53,9 @@ class TripleoBase(StrategyBase):
self._has_hosts_cache_all = False
def _print(self, msg, host=None, level=1):
# host needs to be a string or bad things happen. LP#1904917
if host and not isinstance(host, str):
host = None
display.verbose(msg, host=host, caplevel=level)
def _debug(self, msg, host=None):

View File

@ -149,7 +149,7 @@ class StrategyModule(BASE.TripleoBase):
def _advance_host(self, host, task):
"""Advance the host's task as necessary"""
self._debug('_advance_host {}'.format(host), host)
self._debug('_advance_host {}'.format(host))
host_name = host.get_name()
# build get_vars call params