Updated openstack/openstack
Project: openstack/oslo-incubator  5e59994c7ce483d21816b82acc12d69ccf08fde5

cfgfilter: finally make this thing useful!

cfgfilter was initially conceived to help enforce the usage of
import_opt() within Nova - that a module which uses ConfigFilter
will be prevented from using any config option unless it was
registered or imported by that module.

It turns out the more interesting that is very closely related wasn't
addressed - that any options registered by a module which uses
ConfigFilter should not be visible outside of that module.

The latter use case is hugely important for libraries like
oslo.messaging. Here we are registering options (e.g. 'rpc_backend')
inside the library in such a way that users of the library can
access those config options. Yet it is highly likely that these
options will be renamed in the future, thereby breaking code which
accesses these options (but not breaking config files which uses
these options).

The way this new ConfigFilter implementation works is to recognize
there are two parts to a ConfigOpts instance - the set of option
schemas registered with it and raw config values parsed from config
files and the command line. If we simply ensure that ConfigOpts has
its own set of option schemas but yet shares the parsed values with
the underlying ConfigOpts, we allow ConfigFilter to act as a distinct
view of the underlying parsed values.

Note: this implementation is using private implementation details
of the oslo.config library and, as such, it really needs to be
included in oslo.config before anyone starts using it. To make sure
no-one misses this point, I'ved added a subtle warning you must
acknowledge before using the API.

Change-Id: Idefdf024776851a37a23590373d770cf7e512b94