[openstack-dev] [oslo.cfg] Dynamically load in options/groups values from the configuration files

Doug Hellmann doug at doughellmann.com
Mon Jul 28 13:27:46 UTC 2014


On Jul 27, 2014, at 11:12 PM, Baohua Yang <yangbaohua at gmail.com> wrote:

> Dear all
>     Thanks for all the responses!
>     First, I threw the question actually wanting to hear other voices of the similar requirements of dynamic parsing.
>     Glad to get all supports and also questions.
>     The scenario is that sometime we might define some groups in the config file with changing names. One not appropriated example is that we add a network element with properties as
>     [xxx_box]
>     property1=aaa
>     property2=bbb
> 
>     In this case, the parser should automatically read in the xxx_box and parses its properties, which would extend the power of the current config lib.
>     Although we can utilize explicit definitions of groups names in our code to ignore uninterested groups in the configuration file, I think it would be more flexible to keep the functionality to read in those undefined groups.
>     Now I am sure it's impossible to do so with existing olso.config lib.
>     Thanks for all the feedbacks, and would like to get more comments on whether we should implement this! 

oslo.config wants options to be registered with well-known names so they are discoverable by tools that produce documentation for deployers. Are the xxx_box names going to be like that? Are all of the options in xxx_box groups the same, or can they vary? How would you describe to a deployer what the group names can be and which options can be included in the section?

Doug

>     
> 
> 
> 
> 
> 
> 
> 
> 
> On Fri, Jul 25, 2014 at 1:58 AM, Yuriy Taraday <yorik.sar at gmail.com> wrote:
> 
> 
> 
> On Thu, Jul 24, 2014 at 4:14 PM, Doug Hellmann <doug at doughellmann.com> wrote:
> 
> On Jul 23, 2014, at 11:10 PM, Baohua Yang <yangbaohua at gmail.com> wrote:
> 
>> Hi, all
>>      The current oslo.cfg module provides an easy way to load name known options/groups from he configuration files.
>>       I am wondering if there's a possible solution to dynamically load them?
>> 
>>       For example, I do not know the group names (section name in the configuration file), but we read the configuration file and detect the definitions inside it.
>> 
>> #Configuration file:
>> [group1]
>> key1 = value1
>> key2 = value2
>> 
>>        Then I want to automatically load the group1. key1 and group2. key2, without knowing the name of group1 first.
> 
> If you don’t know the group name, how would you know where to look in the parsed configuration for the resulting options?
> 
> I can imagine something like this:
> 1. iterate over undefined groups in config;
> 2. select groups of interest (e.g. by prefix or some regular expression);
> 3. register options in them;
> 4. use those options.
> 
> Registered group can be passed to a plugin/library that would register its options in it.
> 
> So the only thing that oslo.config lacks in its interface here is some way to allow the first step. The rest can be overcomed with some sugar.
> 
> -- 
> 
> Kind regards, Yuriy.
> 
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
> 
> 
> 
> 
> -- 
> Best wishes!
> Baohua
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20140728/80a5953c/attachment.html>


More information about the OpenStack-dev mailing list