Revision history [back]

Python module for *writing* openstack style config files?

Is there a Python module that can write OpenStack-style INI configuration files?

The OpenStack project using an INI-style configuration file format parsed by the oslo.config module. There are a few things that make it incompatible with the standard INI parsing and generating tools, such as ConfigParser or iniparse:

• The DEFAULT section is not meant to be treated specially.

• Options can take multiple values by listing them multiple times in the config file. That is, the result of:

option_foo = value1
option_foo = value2


Is:

option_foo = ['value1', 'value2']


The oslo.config.cfg module has a parser that will read these files without a problem. I wanted to write something similar to crudini that would read a data soruce for configuration values and then generate an appropriate configuration file.

While I can certainly write one myself, I'm curious if there is a solution out there already.

Python module for *writing* openstack style config files?

Is there a Python module that can write OpenStack-style INI configuration files?

The OpenStack project using an INI-style configuration file format parsed by the oslo.config module. There are a few things that make it incompatible with the standard INI parsing and generating tools, such as ConfigParser or iniparse:

• The DEFAULT section is not meant to be treated specially.

• Options can take multiple values by listing them multiple times in the config file. That is, the result of:

option_foo = value1
option_foo = value2


Is:

option_foo = ['value1', 'value2']


The oslo.config.cfg module has a parser that will read these files without a problem. I wanted to write something similar to crudini (which itself does not currently handle multi-valued options) that would read a data soruce for configuration values and then generate an appropriate configuration file.

While I can certainly write one myself, I'm curious if there is a solution out there already.