-
Notifications
You must be signed in to change notification settings - Fork 54
Configuration should be checked on startup. #45
Comments
congrats on our 4 years old issue 🥇 |
here is the thought: Should we look into automation on configuring HIL with different types of backend through Ansible? If so, we can configure ansible to validating the configuration and throw proper error messages or even give a verbose indication on how to proceed. |
I am antagonistic to offloading this on to the automation tool. Right now setting up HIL manually is something mere mortals can do; I want to keep it that way. |
What we could have is to:
So this issue is under option 2 and we should discuss on how we can validate the configure file in HIL. Any suggestions? |
One rough design: first pull things from the configparser object into a dictionary, and then use the schema library to validate it. Each extension could provide provide additional schema for its own section. |
So then core HIL and each of the extensions would have one schema that defines everything that can go into the config file? I can give this one a go, that idea makes sense to me. |
@Izhmash, yeah, basically. One way you could make it a bit more strict: HIL core would define a schema describing the sections it defines itself, something like: core_schema = {
'auth': {
Optional('log_level'): bool,
},
'devel': {
Optional('dry_run'): bool,
},
...
'extensions': {str: ''},
} Then, on import, each extension, could add it's own partial schema to the core: # in hil/ext/auth/keystone.py
core_schema[__name__] = {
'username': str,
'password': str,
...
} Finally, the core would validate against the full schema once all the extensions are loaded and have had a chance to modify it to their liking. |
Ok, that sounds good to me. |
Closing, now thatn #966 is merged. |
Right now if a config file option isn't set properly, the haas will just fail at runtime, when it tries to use that option. We should be validating the configuration on startup.
The text was updated successfully, but these errors were encountered: