Fix regression in file_tree pillar (Fixes #31223.)

This commit is contained in:
Paul Prince 2016-02-15 14:00:38 -05:00
parent 415654ee9e
commit d592d8636b

View file

@ -203,11 +203,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)]