Fix encoding issues with file paths. (#50830)

* Fix encoding issues with file paths.

Discovered while testing with ANSIBLE_CONFIG env var set to a path
that contained unicode characters while LC_ALL=C.

* Fix unit tests.

* Fix another path encoding issue.
This commit is contained in:
Matt Clay 2019-01-14 13:06:47 -08:00 committed by GitHub
parent 15b1a31aa8
commit 465df0ef8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 13 deletions

View file

@ -23,7 +23,7 @@ import os
from ansible import constants as C
from ansible.errors import AnsibleParserError
from ansible.module_utils._text import to_text, to_native
from ansible.module_utils._text import to_bytes, to_text, to_native
from ansible.playbook.play import Play
from ansible.playbook.playbook_include import PlaybookInclude
from ansible.plugins.loader import get_all_plugin_loaders
@ -68,7 +68,7 @@ class Playbook:
for name, obj in get_all_plugin_loaders():
if obj.subdir:
plugin_path = os.path.join(self._basedir, obj.subdir)
if os.path.isdir(plugin_path):
if os.path.isdir(to_bytes(plugin_path)):
obj.add_directory(plugin_path)
try: