fix nginx config discovery for absolute include patterns
This commit is contained in:
parent
07528dad13
commit
2443aecaf6
1 changed files with 9 additions and 1 deletions
|
@ -49,7 +49,15 @@ def discover_configs() -> Set[Path]:
|
||||||
found.add(path)
|
found.add(path)
|
||||||
for pattern in INCLUDE_RE.findall(text):
|
for pattern in INCLUDE_RE.findall(text):
|
||||||
pattern = os.path.expanduser(pattern.strip())
|
pattern = os.path.expanduser(pattern.strip())
|
||||||
for included in path.parent.glob(pattern):
|
if os.path.isabs(pattern):
|
||||||
|
# ``Path.glob`` does not allow absolute patterns, so we
|
||||||
|
# anchor at the filesystem root and remove the leading
|
||||||
|
# separator.
|
||||||
|
base = Path(os.sep)
|
||||||
|
glob_iter = base.glob(pattern.lstrip(os.sep))
|
||||||
|
else:
|
||||||
|
glob_iter = path.parent.glob(pattern)
|
||||||
|
for included in glob_iter:
|
||||||
if included.is_file() and included not in found:
|
if included.is_file() and included not in found:
|
||||||
queue.append(included)
|
queue.append(included)
|
||||||
return found
|
return found
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue