[openstack-dev] Adding write capability in oslo-config
Mark McLoughlin
markmc at redhat.com
Mon Mar 4 20:34:03 UTC 2013
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
but that doesn't handle multi-str options.
> 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.
More information about the OpenStack-dev
mailing list