summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty Taylor <mordred@inaugust.com>2017-09-17 12:43:49 -0500
committerMonty Taylor <mordred@inaugust.com>2017-09-17 12:43:49 -0500
commit645c3d684d17f47c86f32217e406b0db003e6587 (patch)
tree7228e645cc8ac376017c1e9116e043c565160e78
parentad1188ba7fff851633f57ddd46324a61eebe68fe (diff)
Support zuul.d directories0.1.6
Notes
Notes (review): Code-Review+1: Andreas Jaeger <jaegerandi@gmail.com> Code-Review+2: James E. Blair <corvus@inaugust.com> Code-Review+2: Tobias Henkel <tobias.henkel@bmw.de> Code-Review+1: David Moreau Simard <dms@redhat.com> Workflow+1: Tobias Henkel <tobias.henkel@bmw.de> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Wed, 20 Sep 2017 03:14:12 +0000 Reviewed-on: https://review.openstack.org/504797 Project: openstack-infra/zuul-sphinx Branch: refs/heads/master
-rw-r--r--zuul_sphinx/zuul.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/zuul_sphinx/zuul.py b/zuul_sphinx/zuul.py
index 7cfb9c7..d524788 100644
--- a/zuul_sphinx/zuul.py
+++ b/zuul_sphinx/zuul.py
@@ -35,7 +35,7 @@ class ZuulDirective(Directive):
35 def find_zuul_yaml(self): 35 def find_zuul_yaml(self):
36 root = self.state.document.settings.env.relfn2path('.')[1] 36 root = self.state.document.settings.env.relfn2path('.')[1]
37 while root: 37 while root:
38 for fn in ['zuul.yaml', '.zuul.yaml']: 38 for fn in ['zuul.yaml', '.zuul.yaml', 'zuul.d', '.zuul.d']:
39 path = os.path.join(root, fn) 39 path = os.path.join(root, fn)
40 if os.path.exists(path): 40 if os.path.exists(path):
41 return path 41 return path
@@ -51,11 +51,24 @@ class ZuulDirective(Directive):
51 layout.jobs.append(obj['job']) 51 layout.jobs.append(obj['job'])
52 return layout 52 return layout
53 53
54 def parse_zuul_d(self, path):
55 layout = Layout()
56 for conf in os.listdir(path):
57 with open(os.path.join(path, conf)) as f:
58 data = yaml.safe_load(f)
59 for obj in data:
60 if 'job' in obj:
61 layout.jobs.append(obj['job'])
62 return layout
63
54 def _parse_zuul_layout(self): 64 def _parse_zuul_layout(self):
55 env = self.state.document.settings.env 65 env = self.state.document.settings.env
56 if not env.domaindata['zuul']['layout']: 66 if not env.domaindata['zuul']['layout']:
57 path = self.find_zuul_yaml() 67 path = self.find_zuul_yaml()
58 layout = self.parse_zuul_yaml(path) 68 if path.endswith('zuul.d'):
69 layout = self.parse_zuul_d(path)
70 else:
71 layout = self.parse_zuul_yaml(path)
59 env.domaindata['zuul']['layout_path'] = path 72 env.domaindata['zuul']['layout_path'] = path
60 env.domaindata['zuul']['layout'] = layout 73 env.domaindata['zuul']['layout'] = layout
61 74