[openstack-dev] Adding write capability in oslo-config

Sascha Peilicke saschpe at suse.de
Tue Mar 5 08:18:05 UTC 2013


Am 4. März 2013 21:34:03 schrieb Mark McLoughlin <markmc at redhat.com>:
> Hi Thomas,
>
> On Tue, 2013-03-05 at 01:29 +0800, Thomas Goirand wrote:
> > Hi,
> >
> > As much as I can see, the only thing which oslo-config does is *reading*
> > the config files for an openstack project.
>
> A nitpick perhaps, but oslo-config's niche is reading config values from
> the combination of the command line and config files. If you want simply
> want to use a config files, it doesn't have a huge amount to offer.
>
> > It doesn't seems that it is possible to use the same API to actually
> > write values.
> >
> > As I do the Debian packaging, I would be happy to use oslo-config to be
> > able to read / write values in the different configuration files of
> > Openstack. I need to do that, for example to read, then set the
> > sql_connection DSN string in each package, as Openstack is integrated
> > with dbconfig-common in Debian.
> >
> > The problem is that oslo-config doesn't currently provides a command
> > line tool. Though it would be really trivial to do:
> > oslo-config-get /etc/keystone/keystone.conf \
> > 	DEFAULT admin_token
> >
> > so that I could use that from my debian/*.config scripts.
> >
> > But then I would also need in a debian/*.postinst script:
> > oslo-config-set /etc/keystone/keystone.conf \
> > 	DEFAULT admin_token <password>
> >
> > which isn't currently implemented at all in oslo-config. oslo-config
> > currently can only *read* .ini files, it can't actually *write*
> > directives in them.
> >
> > While I currently need the above in my Debian packaging, I am quite sure
> > that it would be helpful for anyone willing to write automation tools to
> > deploy Openstack, so I am convinced it would be helpful for others to
> > add write functions in oslo-config.
> >
> > Would anyone who worked on oslo-config have some time to write this?
>
> Definitely planned, but it didn't get done in time for Grizzly:
>
>   https://blueprints.launchpad.net/oslo/+spec/oslo-config-cli
>
> In Fedora, we use this:
>
>   https://github.com/fedora-openstack/openstack-utils/blob/master/utils/openstack-config

It may be worth mentioning that we use this in openSUSE too.

>
> but that doesn't handle multi-str options.

And it doesn't put new config values at the correct place when they 
where previously commented out, but at the end of a section instead. 
This particularly annoying for large (nova.conf) files. Both are 
(fixable) shortcommings of iniparse.

>
> > Also, reading the code, it seems that the parser doesn't even implement
> > sections, which surprised me. Is this something planned? Or is it
> > specified that there will never be any 2 of the same directive in
> > different sections of a given configuration file?
>
> We definitely support sections (aka 'groups'), see e.g.
>
>   https://github.com/openstack/oslo-config/blob/59b6720/tests/test_cfg.py#L1043
>
> Cheers,
> Mark.
>
>

Setting useful defaults at package installation time is a common 
distributor's task, so I see some value in having (potentially one) 
official tool for that.

> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
--
With kind regards,
Sascha Peilicke
SUSE Linux GmbH, Maxfeldstr. 5, D-90409 Nuernberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer HRB 16746 (AG Nürnberg)





More information about the OpenStack-dev mailing list