#91 Better type checking for config
Closed: Fixed 7 years ago Opened 8 years ago by lsedlar.

For config options with complex type (e.g. image_build, createiso_skip) we can only express that the value should be a list, but not the type of elements. Due to this, incorrect configuration causes a crash after a lot of work may have been done instead of exiting with reasonable error message immediately after starting.

It would be nice if the config validation was able to express and check complex types.


General plan of attack:

  • wrap PyConfigParser in another class and pass that around – advantages: configuration will be accessed by properties instead of string keys, minimizing risk of typos; default values will be defined in one place
  • consolidate most of the config validations into this class – remove duplication
  • add checking for nested types

There will always be need for each phase to have a separate validate method to check more complex properties, though.

My current status is in PR #375: it is using JSON Schema to describe the configuration. It does not require too many changes in the existing codebase, and has the benefit of not having to reimplement the type checking.

@lsedlar changed the status to Fixed

7 years ago

Login to comment on this ticket.

Metadata