From f40b66d841585de204b205afb7df334800e51049 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Sun, 12 Jul 2015 16:39:27 -0400 Subject: [PATCH] Make sure the basedir is unicode Fixes #10773 --- lib/ansible/parsing/__init__.py | 3 ++- lib/ansible/playbook/role/definition.py | 2 +- lib/ansible/plugins/__init__.py | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/ansible/parsing/__init__.py b/lib/ansible/parsing/__init__.py index 027691d18e..0605afdd74 100644 --- a/lib/ansible/parsing/__init__.py +++ b/lib/ansible/parsing/__init__.py @@ -31,6 +31,7 @@ from ansible.parsing.splitter import unquote from ansible.parsing.yaml.loader import AnsibleLoader from ansible.parsing.yaml.objects import AnsibleBaseYAMLObject, AnsibleUnicode from ansible.utils.path import unfrackpath +from ansible.utils.unicode import to_unicode class DataLoader(): @@ -175,7 +176,7 @@ class DataLoader(): ''' sets the base directory, used to find files when a relative path is given ''' if basedir is not None: - self._basedir = basedir + self._basedir = to_unicode(basedir) def path_dwim(self, given): ''' diff --git a/lib/ansible/playbook/role/definition.py b/lib/ansible/playbook/role/definition.py index d46bca6b2e..1cd84ff778 100644 --- a/lib/ansible/playbook/role/definition.py +++ b/lib/ansible/playbook/role/definition.py @@ -129,7 +129,7 @@ class RoleDefinition(Base, Become, Conditional, Taggable): return (role_name, role_path) else: # we always start the search for roles in the base directory of the playbook - role_search_paths = [os.path.join(self._loader.get_basedir(), 'roles'), './roles', './'] + role_search_paths = [os.path.join(self._loader.get_basedir(), u'roles'), u'./roles', u'./'] # also search in the configured roles path if C.DEFAULT_ROLES_PATH: diff --git a/lib/ansible/plugins/__init__.py b/lib/ansible/plugins/__init__.py index bbbe0bd795..d40a4f5f81 100644 --- a/lib/ansible/plugins/__init__.py +++ b/lib/ansible/plugins/__init__.py @@ -29,6 +29,7 @@ import sys from ansible import constants as C from ansible.utils.display import Display +from ansible.utils.unicode import to_unicode from ansible import errors MODULE_CACHE = {} @@ -38,7 +39,7 @@ _basedirs = [] def push_basedir(basedir): # avoid pushing the same absolute dir more than once - basedir = os.path.realpath(basedir) + basedir = to_unicode(os.path.realpath(basedir)) if basedir not in _basedirs: _basedirs.insert(0, basedir)