Avoid infinite loop in find_zuul_yaml()

Currently there will be an infinite loop when no zuul config can be
found. Terminate the loop when we reach the filesystem root.

Signed-off-by: Dr. Jens Harbott <harbott@osism.tech>
Change-Id: I074f23eeac82531024cd1af0eeb7c502555eacd7
This commit is contained in:
Dr. Jens Harbott 2022-05-03 20:52:09 +02:00
parent 6acbcbb2f9
commit 2272117b40
1 changed files with 1 additions and 1 deletions

View File

@ -79,7 +79,7 @@ class ZuulDirective(Directive):
def find_zuul_yaml(self):
root = self.state.document.settings.env.relfn2path('.')[1]
while root:
while root and root != '/':
for fn in ['zuul.yaml', '.zuul.yaml', 'zuul.d', '.zuul.d']:
path = os.path.join(root, fn)
if os.path.exists(path):