prevent startup when layout.yaml has invalid syntax

Bug #1057471 reported by Antoine "hashar" Musso
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zuul
Triaged
Medium
Unassigned

Bug Description

My layout.yaml had an invalid block making zuul (dev branch) choke with:

ParserError: while parsing a block collection
  in "/etc/zuul/layout.yaml", line 10, column 3
expected <block end>, but found '?'
  in "/etc/zuul/layout.yaml", line 25, column 3
2012-09-27 11:11:04,151 DEBUG zuul.Scheduler: Run handler sleeping

I guess zuul should catch the ParserError exception and abort early.

Revision history for this message
Antoine "hashar" Musso (hashar) wrote :

Similar issue, layout.yaml had no 'jobs' section despite it being marked as optional in the documentation.

Stack trace from zuul dev branch:

2012-09-27 11:17:22,859 ERROR zuul.Scheduler: Exception in run handler:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/zuul-1.0-py2.7.egg/zuul/scheduler.py", line 330, in run
    self._doPauseEvent()
  File "/usr/local/lib/python2.7/dist-packages/zuul-1.0-py2.7.egg/zuul/scheduler.py", line 294, in _doPauseEvent
    self._parseConfig(self.config.get('zuul', 'layout_config'))
  File "/usr/local/lib/python2.7/dist-packages/zuul-1.0-py2.7.egg/zuul/scheduler.py", line 105, in _parseConfig
    for config_job in data['jobs']:
TypeError: 'NoneType' object is not iterable

Same happens when key was named 'project' instead of 'projects' (aka singular vs plural form).

At startup zuul should probably run scheduler._parseConfig() and abort whenever an exception is raised.

Revision history for this message
James E. Blair (corvus) wrote :

Agreed. We should also consider what to do when there's an error during a reconfiguration while zuul is running. We could either remember the old state and keep using it, or exit. Remembering the old state will take a good chunk of extra code, but would be best. Exiting is slightly better than what we have now (keep running while broken). So I think either of those are acceptable solutions, with the first being the preferable long-term goal.

Changed in zuul:
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Antoine "hashar" Musso (hashar) wrote :

You could add a new option to zuul-server that will just do the config check just like apachectl. Then the init script could use that before 'reload' and gracefully fail if anything is wrong in the configuration.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.