invalid buildstream.conf format returns stacktrace

Summary

When writing a buildstream.conf file, i missed an indentation. Running bst pull with this resulted in an ugly stacktrace

Nexus-x240$ bst pull base/ninja.bst                                                                                                                                 ~/projects/gnome-modulesets[master:77477be,?M]
Traceback (most recent call last):
  File "/home/phillipsmyth/.local/bin/bst", line 8, in <module>
    sys.exit(cli())
  File "/home/phillipsmyth/.local/lib/python3.5/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/phillipsmyth/projects/buildstream/buildstream/_frontend/cli.py", line 162, in override_main
    standalone_mode=standalone_mode, **extra)
  File "/home/phillipsmyth/.local/lib/python3.5/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/phillipsmyth/.local/lib/python3.5/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/phillipsmyth/.local/lib/python3.5/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/phillipsmyth/.local/lib/python3.5/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/phillipsmyth/.local/lib/python3.5/site-packages/click/decorators.py", line 27, in new_func
    return f(get_current_context().obj, *args, **kwargs)
  File "/home/phillipsmyth/projects/buildstream/buildstream/_frontend/cli.py", line 448, in pull
    with app.initialized(session_name="Pull"):
  File "/usr/lib/python3.5/contextlib.py", line 59, in __enter__
    return next(self.gen)
  File "/home/phillipsmyth/projects/buildstream/buildstream/_frontend/app.py", line 169, in initialized
    self.context.load(config)
  File "/home/phillipsmyth/projects/buildstream/buildstream/_context.py", line 221, in load
    _yaml.node_validate(overrides, ['artifacts', 'options', 'strict', 'default-mirror'])
  File "/home/phillipsmyth/projects/buildstream/buildstream/_yaml.py", line 948, in node_validate
    invalid = next((key for key in node if key not in valid_keys), None)
  File "/home/phillipsmyth/projects/buildstream/buildstream/_yaml.py", line 948, in <genexpr>
    invalid = next((key for key in node if key not in valid_keys), None)
TypeError: unhashable type: 'ChainMap'
zsh: exit 1     bst pull base/ninja.bst

Steps to reproduce

Create a basic buildstream.conf containing

projects:
  gnome:
  artifacts:
    - url: localhost:5003
      push: false

Note that the artifacts line is on the same indentation level as the project name "gnome"

What is the current bug behavior?

A stacktrace is returned

What is the expected correct behavior?

A clean YAML formatting error should be output, ideally with line numbers

  • BuildStream version affected: /milestone %BuildStream_v1.x