Improve warning details
Currently, if you make a warning mistake in your inline YAML you get warning output like: Warning, treated as error: /home/.../zuul.d:728:Unexpected indentation. This doesn't give you any clue as to what was actually wrong. Rework adding the content so that we add the job/template name as the source. You'll now get something like: Warning, treated as error: Job "failing-job" included in /home/.../doc/source/jobs.rst:6:Unexpected indentation. which lets you know the job/template that is causing the error, and where the auto include was sourced from. Change-Id: I3144cb9bf689724d113c9b4b126f975f34f565c3
This commit is contained in:
parent
046c5e548c
commit
6b9fa90602
|
@ -480,15 +480,17 @@ class ZuulAutoJobsDirective(ZuulDirective):
|
||||||
has_content = False
|
has_content = False
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
lines = []
|
env = self.state.document.settings.env
|
||||||
names = set()
|
names = set()
|
||||||
for job in self.zuul_layout.jobs:
|
for job in self.zuul_layout.jobs:
|
||||||
name = job['name']
|
name = job['name']
|
||||||
if name in names:
|
if name in names:
|
||||||
continue
|
continue
|
||||||
lines.extend(self.generate_zuul_job_content(name))
|
lines = self.generate_zuul_job_content(name)
|
||||||
|
location = 'Job "%s" included in %s' % \
|
||||||
|
(name, env.doc2path(env.docname))
|
||||||
|
self.state_machine.insert_input(lines, location)
|
||||||
names.add(name)
|
names.add(name)
|
||||||
self.state_machine.insert_input(lines, self.zuul_layout_path)
|
|
||||||
return []
|
return []
|
||||||
|
|
||||||
class ZuulAutoProjectTemplateDirective(ZuulDirective):
|
class ZuulAutoProjectTemplateDirective(ZuulDirective):
|
||||||
|
@ -503,15 +505,17 @@ class ZuulAutoProjectTemplatesDirective(ZuulDirective):
|
||||||
has_content = False
|
has_content = False
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
lines = []
|
env = self.state.document.settings.env
|
||||||
names = set()
|
names = set()
|
||||||
for template in self.zuul_layout.project_templates:
|
for template in self.zuul_layout.project_templates:
|
||||||
name = template.name
|
name = template.name
|
||||||
if name in names:
|
if name in names:
|
||||||
continue
|
continue
|
||||||
lines.extend(self.generate_zuul_project_template_content(name))
|
lines = self.generate_zuul_project_template_content(name)
|
||||||
|
location = 'Template "%s" included in %s' % \
|
||||||
|
(name, env.doc2path(env.docname))
|
||||||
|
self.state_machine.insert_input(lines, location)
|
||||||
names.add(name)
|
names.add(name)
|
||||||
self.state_machine.insert_input(lines, self.zuul_layout_path)
|
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue