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

Thomas Goirand zigo at debian.org
Tue Mar 5 18:24:58 UTC 2013


On 03/05/2013 04:18 PM, Sascha Peilicke wrote:
> 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.

The problem I'm facing as well is that using the python module would
mean that I would break debconf (since I would need to add a
pre-depends). So I haven't made up my mind yet if I should use a
Pre-Depends: python-oslo-config, and use that with something like this:

pkgos_get_config_value () {
	RET=$(python -c "import sys
from oslo.config import cfg

config_file_opts = [
    cfg.StrOpt('admin_token'),
]
CONF = cfg.CONF
CONF.register_opts(config_file_opts)

myarg=sys.argv[1:]
myarg.append('--config-file=/etc/keystone/keystone.conf')
CONF(myarg)
print CONF.admin_token")
}

or if I'd be better re-writing the same, from scratch, without using
oslo-config, in a shell script (which isn't that hard to do, my only
concern would be if the format evolves).

Would it make sense to include such shell script code (if I decide to
write it) in the oslo-config project itself? Its use is outside of the
scope of python code, but could be reused somewhere else...

Thoughts?

Thomas



More information about the OpenStack-dev mailing list