[openstack-dev] [nova][oslo] oslo.config and import chains

Matthew Booth mbooth at redhat.com
Fri Aug 8 10:04:52 UTC 2014

On 07/08/14 18:54, Kevin L. Mitchell wrote:
> On Thu, 2014-08-07 at 17:46 +0100, Matthew Booth wrote:
>>> In any case, the operative point is that CONF.<attribute> must
>> always be
>>> evaluated inside run-time code, never at module load time.
>> ...unless you call register_opts() safely, which is what I'm
>> proposing.
> No, calling register_opts() at a different point only fixes the import
> issue you originally complained about; it does not fix the problem that
> the configuration option is evaluated at the wrong time.  The example
> code you included in your original email evaluates the configuration
> option at module load time, BEFORE the configuration has been loaded,
> which means that the argument default will be the default of the
> configuration option, rather than the configured value of the
> configuration option.  Configuration options must be evaluated at
> RUN-TIME, after configuration is loaded; they must not be evaluated at
> LOAD-TIME, which is what your original code does.

Ah, thanks, Kevin. The pertinent information is that the config has not
been loaded at module import time, and you'll therefore always get a

Matthew Booth
Red Hat Engineering, Virtualisation Team

Phone: +442070094448 (UK)
GPG ID:  D33C3490
GPG FPR: 3733 612D 2D05 5458 8A8A 1600 3441 EA19 D33C 3490

More information about the OpenStack-dev mailing list