[openstack-dev] [Oslo] Give CLI the priority over config files

Monty Taylor mordred at inaugust.com
Fri May 3 14:25:48 UTC 2013



On 05/03/2013 10:16 AM, Flavio Percoco wrote:
> Hi,
> 
> NOTE: Recently, something similar to $topic was discussed[0] in this list.
> 
> I was looking into a glance-manage "bug"[1] and found out that oslo.config
> gives priority to parameters configured in config files over the ones
> passed in the CLI (I missed the part that says: "Option values in
> config files override those on the command line"). Although I understand
> it was designed like that, I think this
> behaviour is wrong.
> 
> Besides the fact that this is causing some confusion to CLI tools
> users (see glance-manage bug), it makes it impossible to define
> configuration parameters that are meant to be overridden by CLI
> arguments.
> 
> That being said, I would like to propose to invert that behaviour and
> let CLI arguments override configuration parameters. Reasoning behind
> this is that it is already possible to define config parameters that
> are hidden from the CLI, which means that parameters that shouldn't be
> overridden by the CLI should not be exposed there.

I agree. I believe the natural order of things is:

- Default value in source code
- Overridden by value in config file
- Overridden by value in environment variable
- Overridden by value given as command line option

Basically due to the relative permanence of each. If you are running a
program by hand with direct CLI options - you probably want the option
you give to work. If you wanted the options in the config file to
happen, you'd probably just start the service as usual.

> Another option could be to have "just CLI" options but that doesn't
> fix cases like [1].
> 
> FWIW, It is not written anywhere that CLI arguments should override
> configuration files but it does seem to be the natural way of using
> CLIs, at least for me.
> 
> Thoughts? Objections? Impacts not being considered?
> How should cases like [1] be addressed?
> 
> Cheers,
> FF
> 
> [0]
> http://lists.openstack.org/pipermail/openstack-dev/2013-March/006766.html
> 
> [1] https://bugs.launchpad.net/glance/+bug/1175570
> 



More information about the OpenStack-dev mailing list