[openstack-dev] [Oslo] Give CLI the priority over config files
Jay Pipes
jaypipes at gmail.com
Fri May 3 14:50:07 UTC 2013
On 05/03/2013 10:25 AM, Monty Taylor wrote:
> 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.
Agreed. This is generally the default behavior of most programs,
including the python-gflags module that oslo.config replaced in Nova.
-jay
More information about the OpenStack-dev
mailing list