summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Wienand <iwienand@redhat.com>2018-09-04 11:04:10 +1000
committerIan Wienand <iwienand@redhat.com>2018-09-04 11:04:10 +1000
commit6b9fa90602d41cd51265e402c2009d1a03fe730d (patch)
tree2db2b3baa7e1a8a17b86361168803af0ecee84a5
parent046c5e548c7c42acc55fa4b5e58bab26786070e2 (diff)
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
Notes
Notes (review): Code-Review+2: Tobias Henkel <tobias.henkel@bmw.de> Code-Review+2: James E. Blair <corvus@inaugust.com> Workflow+1: James E. Blair <corvus@inaugust.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Tue, 04 Sep 2018 22:46:56 +0000 Reviewed-on: https://review.openstack.org/599469 Project: openstack-infra/zuul-sphinx Branch: refs/heads/master
-rw-r--r--zuul_sphinx/zuul.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/zuul_sphinx/zuul.py b/zuul_sphinx/zuul.py
index df3895d..29f1d84 100644
--- a/zuul_sphinx/zuul.py
+++ b/zuul_sphinx/zuul.py
@@ -480,15 +480,17 @@ class ZuulAutoJobsDirective(ZuulDirective):
480 has_content = False 480 has_content = False
481 481
482 def run(self): 482 def run(self):
483 lines = [] 483 env = self.state.document.settings.env
484 names = set() 484 names = set()
485 for job in self.zuul_layout.jobs: 485 for job in self.zuul_layout.jobs:
486 name = job['name'] 486 name = job['name']
487 if name in names: 487 if name in names:
488 continue 488 continue
489 lines.extend(self.generate_zuul_job_content(name)) 489 lines = self.generate_zuul_job_content(name)
490 location = 'Job "%s" included in %s' % \
491 (name, env.doc2path(env.docname))
492 self.state_machine.insert_input(lines, location)
490 names.add(name) 493 names.add(name)
491 self.state_machine.insert_input(lines, self.zuul_layout_path)
492 return [] 494 return []
493 495
494class ZuulAutoProjectTemplateDirective(ZuulDirective): 496class ZuulAutoProjectTemplateDirective(ZuulDirective):
@@ -503,15 +505,17 @@ class ZuulAutoProjectTemplatesDirective(ZuulDirective):
503 has_content = False 505 has_content = False
504 506
505 def run(self): 507 def run(self):
506 lines = [] 508 env = self.state.document.settings.env
507 names = set() 509 names = set()
508 for template in self.zuul_layout.project_templates: 510 for template in self.zuul_layout.project_templates:
509 name = template.name 511 name = template.name
510 if name in names: 512 if name in names:
511 continue 513 continue
512 lines.extend(self.generate_zuul_project_template_content(name)) 514 lines = self.generate_zuul_project_template_content(name)
515 location = 'Template "%s" included in %s' % \
516 (name, env.doc2path(env.docname))
517 self.state_machine.insert_input(lines, location)
513 names.add(name) 518 names.add(name)
514 self.state_machine.insert_input(lines, self.zuul_layout_path)
515 return [] 519 return []
516 520
517 521