Update cfg from openstack-common

Use openstack-common's update.py script to pull in some recent changes:

 * Add the Mapping interface to cfg.ConfigOpts
 * Add support to cfg for disabling interspersed args

Make use of both of these in nova/flags.py.

Add some dire warnings to HACKING about directly modifying the copy of
openstack-common code. I'm confident they won't be ignored :-)

Change-Id: I7ef75d18922c0bbb8844453b48cad0418034bc11
This commit is contained in:
Mark McLoughlin
2012-02-03 00:50:58 +00:00
parent 435fa6c42f
commit 67307bb7fe
2 changed files with 20 additions and 5 deletions

View File

@@ -179,3 +179,18 @@ without the patch and passes with the patch.
For more information on creating unit tests and utilizing the testing
infrastructure in OpenStack Nova, please read nova/testing/README.rst.
openstack-common
----------------
A number of modules from openstack-common are imported into the project.
These modules are "incubating" in openstack-common and are kept in sync
with the help of openstack-common's update.py script. See:
http://wiki.openstack.org/CommonLibrary#Incubation
The copy of the code should never be directly modified here. Please
always update openstack-common first and then run the script to copy
the changes across.

View File

@@ -69,7 +69,7 @@ class FlagValues(object):
def __init__(self):
self._conf = cfg.ConfigOpts()
self._conf._oparser.disable_interspersed_args()
self._conf.disable_interspersed_args()
self._opts = {}
self.Reset()
@@ -128,7 +128,7 @@ class FlagValues(object):
self._conf.set_default(name, default)
def __iter__(self):
return self.FlagValuesDict().iterkeys()
return self._conf.iterkeys()
def __getitem__(self, name):
self._parse()
@@ -147,12 +147,12 @@ class FlagValues(object):
def FlagValuesDict(self):
self._parse()
ret = {}
for opt in self._opts.values():
ret[opt.dest] = getattr(self, opt.dest)
for name in self._conf:
ret[name] = getattr(self, name)
return ret
def add_option(self, opt):
if opt.dest in self._opts:
if opt.dest in self._conf:
return
self._opts[opt.dest] = opt