Merge pull request #31225 from pprince/PR/bugfix/file_tree

Fix in file_tree pillar (Fixes #31223.)
This commit is contained in:
Erik Johnson 2016-02-18 00:06:12 -06:00
commit c58f654bc3

View file

@ -205,11 +205,12 @@ def _construct_pillar(top_dir, follow_dir_links, keep_newline=False):
# Find current path in pillar tree
pillar_node = pillar
norm_dir_path = os.path.normpath(dir_path)
prefix = os.path.relpath(norm_dir_path, norm_top_dir)
if norm_dir_path != norm_top_dir:
prefix = rel_path = os.path.relpath(norm_dir_path, norm_top_dir)
path_parts = []
while rel_path:
rel_path, tail = os.path.split(rel_path)
head = prefix
while head:
head, tail = os.path.split(head)
path_parts.insert(0, tail)
while path_parts:
pillar_node = pillar_node[path_parts.pop(0)]