Sort dirs and filenames when os.walk()ing

Zuul processes config files in zuul.d dirs in a sorted fashion. Emulate
this here so that the docs we produce are in line with the configs zuul
produces.

Change-Id: I83902efbb1161a0def436121aea2597a89044144
This commit is contained in:
Clark Boylan 2020-04-29 09:12:16 -07:00
parent 38bf2470b8
commit 264a9fca1c

View File

@ -106,6 +106,9 @@ class ZuulDirective(Directive):
# zuul.d configs are recursively loaded in zuul so we recursively
# load them here too.
for (dirpath, dirnames, filenames) in os.walk(path):
# Zuul parses things in order, we do too.
dirnames.sort()
filenames.sort()
for conf in filter(lambda x: x.endswith('.yaml'), filenames):
conf_path = os.path.join(dirpath, conf)
with open(conf_path) as f: