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

Kevin L. Mitchell kevin.mitchell at rackspace.com
Thu Aug 7 17:54:55 UTC 2014


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.
-- 
Kevin L. Mitchell <kevin.mitchell at rackspace.com>
Rackspace




More information about the OpenStack-dev mailing list