diff options
author | Brian Coca <brian.coca+git@gmail.com> | 2017-06-19 14:47:35 -0400 |
---|---|---|
committer | Brian Coca <brian.coca+git@gmail.com> | 2017-06-19 16:35:50 -0400 |
commit | e08f068dcaec502a1bcd39f0721c0de50c8b6187 (patch) | |
tree | c7fdbfc8b4c965ad68bf0b4a6bc8e5d213e15cdd | |
parent | 06c21b4bec406340d3e8f60306be571d650424c9 (diff) | |
download | ansible-e08f068dcaec502a1bcd39f0721c0de50c8b6187.tar.gz |
ensure proper typing of path, cause py3 listdir
since now output is based on input, we need to make sure its always same
fixes #25856
-rw-r--r-- | lib/ansible/plugins/vars/host_group_vars.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/ansible/plugins/vars/host_group_vars.py b/lib/ansible/plugins/vars/host_group_vars.py index 1d2255d172..e72eae4552 100644 --- a/lib/ansible/plugins/vars/host_group_vars.py +++ b/lib/ansible/plugins/vars/host_group_vars.py @@ -99,7 +99,7 @@ class VarsModule(BaseVarsPlugin): # first look for w/o extensions if os.path.exists(b_path): if os.path.isdir(b_path): - found.extend(self._get_dir_files(b_path)) + found.extend(self._get_dir_files(to_text(b_path))) else: found.append(b_path) else: @@ -122,14 +122,14 @@ class VarsModule(BaseVarsPlugin): found = [] for spath in os.listdir(path): - if not spath.startswith('.') and not spath.endswith('~'): # skip hidden and backups + if not spath.startswith(b'.') and not spath.endswith(b'~'): # skip hidden and backups ext = os.path.splitext(spath)[-1] full_spath = os.path.join(path, spath) if os.path.isdir(full_spath) and not ext: # recursive search if dir found.extend(self._get_dir_files(full_spath)) - elif os.path.isfile(full_spath) and (not ext or ext in C.YAML_FILENAME_EXTENSIONS): + elif os.path.isfile(full_spath) and (not ext or to_text(ext) in C.YAML_FILENAME_EXTENSIONS): # only consider files with valid extensions or no extension found.append(full_spath) |