improved nmap fix, updated as per fb (#53280)

(cherry picked from commit 5280ae917c)
This commit is contained in:
Brian Coca 2019-03-04 14:47:38 -05:00 committed by GitHub
parent 5734b4e69e
commit b8799ef84e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -126,8 +126,13 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
host = None
ip = None
ports = []
for line in stdout.splitlines():
line = to_text(line)
try:
t_stdout = to_text(stdout, errors='surrogate_or_strict')
except UnicodeError as e:
raise AnsibleParserError('Invalid (non unicode) input returned: %s' % to_native(e))
for line in t_stdout.splitlines():
hits = self.find_host.match(line)
if hits:
if host is not None: