[openstack-dev] [Nova] Configuration validation
ogelbukh at mirantis.com
Wed Nov 13 19:19:24 UTC 2013
On Wed, Nov 13, 2013 at 9:49 PM, Doug Hellmann
<doug.hellmann at dreamhost.com>wrote:
> On Mon, Nov 11, 2013 at 6:08 PM, Mark McLoughlin <markmc at redhat.com>wrote:
>> One thing worth trying would be to encode the validation rules in the
>> config option declaration.
>> Some rules could be straightforward, like:
>> opts = [
>> but the rule you describe is more complex e.g.
>> def validate_proxy_url(conf, group, key, value):
>> if not conf.vnc_enabled:
>> if conf.ssl_only and value.startswith("http://"):
>> raise ValueError('ssl_only option detected, but ...')
>> opts = [
>> I'm not sure I love this yet, but it's worth experimenting with.
> One thing to keep in mind with the move to calling register_opt() at
> runtime instead of import time is the service may run for a little while
> before it reaches the point in the code where the option validation code is
> triggered. So I like the idea, but we may want a shortcut for validation.
> We could add a small app to oslo.config that will load the options in the
> same way the conf generator and doc tool will, but then also read the
> configuration file and perform the validation.
We implement similar approach in Rubick . Collector script generates
configuration schema from code , while generator script  allows to
have different versions of configuration schema:
I think it would be useful to discuss pros and cons of contributing parts
of this code to oslo.config.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the OpenStack-dev