summaryrefslogtreecommitdiffstats
path: root/tests/testmods
Commit message (Collapse)AuthorAgeFilesLines
* Add ConfigFilter wrapper classMark McLoughlin2013-02-183-0/+63
| | | | | | | | | | | | | | | | | | | | | | | | | Implements blueprint cfg-filter-view At the moment, if a module requires a configuration option from another module, we do: CONF.import_opt('source.module', 'option_name') but, in fact, all options from the imported module are available for use. The new ConfigFilter class makes it possible to enforce which options are available within a module e.g. with CONF = cfgfilter.ConfigFilter(cfg.CONF) CONF.import_opt('foo', 'source.module') CONF.register_opt(StrOpt('bar')) then the foo and bar options would be the only options available via this CONF object while still being available via the global cfg.CONF object. Change-Id: Ie3aa2cd090a626da8afd27ecb78853cbf279bc8b
* Use oslo-config-2013.1b3Mark McLoughlin2013-02-173-3/+3
| | | | | | | | | | | | | | | The cfg API is now available via the oslo-config library, so switch to it and remove the copied-and-pasted version. Add the 2013.1b3 tarball to tools/pip-requires - this will be changed to 'oslo-config>=2013.1' when oslo-config is published to pypi. This will happen in time for grizzly final. Remove the 'deps = pep8==1.3.3' and 'deps = pyflakes' from tox.ini as it means all the other deps get installed with easy_install which can't install oslo-config from the URL. Change-Id: I4815aeb8a9341a31a250e920157f15ee15cfc5bc
* Implements import_groupZhongyue Luo2013-01-311-0/+21
| | | | | | | | | Created import_group method in cfg.py Added testcases Fixes bug #1107843 Change-Id: I427d4069dacbb6e586687370adbb08b5d50f7b63
* Add import_opt() method to ConfigOptsMark McLoughlin2012-07-313-0/+57
Related to blueprint cfg-global-object When using the global config object pattern, you often have modules which define options that are referenced in other options. So, for example if module A defined option 'foo' and module be needed to reference that option, you might do: import A print CONF.foo However, this makes it entirely unclear to the casual reader why module A was imported. Nova has a flags.DECLARE() function that helps with this problem by allowing you to do: flags.DECLARE('foo', 'A') The function simply imports module A and checks that the 'foo' option is now defined in the global config object. This is fine, but it is also implicit that this function applies to the global config object. Instead, let's do the following: CONF.import_opt('foo', 'A') Change-Id: I7b98f5be71068bbde70cc0eab991eaebb577de52