1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

properly convert inputs to handle bytes/unicode (#53072)

* properly convert inputs to handle bytes/unicode

  fixes #52186

* Update changelogs/fragments/nmap_bytes_fix.yml

Co-Authored-By: bcoca <bcoca@users.noreply.github.com>
This commit is contained in:
Brian Coca 2019-02-28 11:51:15 -05:00 committed by GitHub
parent d2bdbadb03
commit 55dc63be3a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- convert input into text to ensure valid comparisons in nmap inventory plugin

View file

@ -57,7 +57,7 @@ from subprocess import Popen, PIPE
from ansible import constants as C
from ansible.errors import AnsibleParserError
from ansible.module_utils._text import to_native
from ansible.module_utils._text import to_native, to_text
from ansible.plugins.inventory import BaseInventoryPlugin, Constructable, Cacheable
@ -127,6 +127,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
ip = None
ports = []
for line in stdout.splitlines():
line = to_text(line)
hits = self.find_host.match(line)
if hits:
if host is not None: