Skip to content
This repository has been archived by the owner on Apr 27, 2022. It is now read-only.

Configuration should be checked on startup. #45

Closed
zenhack opened this issue Apr 15, 2014 · 9 comments
Closed

Configuration should be checked on startup. #45

zenhack opened this issue Apr 15, 2014 · 9 comments
Assignees
Milestone

Comments

@zenhack
Copy link
Contributor

zenhack commented Apr 15, 2014

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.

@henn henn added this to the 0.3 milestone Jun 1, 2017
@xuhang57
Copy link
Contributor

congrats on our 4 years old issue 🥇

@xuhang57
Copy link
Contributor

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.

Thoughts? @zenhack @naved001 @Izhmash

@zenhack
Copy link
Contributor Author

zenhack commented Feb 15, 2018

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.

@xuhang57
Copy link
Contributor

What we could have is to:

  1. Automation on HIL deployment
  2. Mere mortals approach: Manually HIL deployment

So this issue is under option 2 and we should discuss on how we can validate the configure file in HIL.

Any suggestions?

@zenhack
Copy link
Contributor Author

zenhack commented Feb 19, 2018

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.

@ianballou
Copy link
Contributor

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.

@zenhack
Copy link
Contributor Author

zenhack commented Feb 22, 2018

@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.

@ianballou
Copy link
Contributor

Ok, that sounds good to me.

@zenhack
Copy link
Contributor Author

zenhack commented Apr 3, 2018

Closing, now thatn #966 is merged.

@zenhack zenhack closed this as completed Apr 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants