Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

properly convert inputs to handle bytes/unicode #53072

Merged
merged 2 commits into from
Feb 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/nmap_bytes_fix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- convert input into text to ensure valid comparisons in nmap inventory plugin
3 changes: 2 additions & 1 deletion lib/ansible/plugins/inventory/nmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@

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


Expand Down Expand Up @@ -127,6 +127,7 @@ def parse(self, inventory, loader, path, cache=False):
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:
Expand Down