From 67307bb7fea79a3a25fa9b27270068b9e82149eb Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Fri, 3 Feb 2012 00:50:58 +0000 Subject: [PATCH] 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 --- HACKING.rst | 15 +++++++++++++++ nova/flags.py | 10 +++++----- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/HACKING.rst b/HACKING.rst index 975498a0..b7e2564d 100644 --- a/HACKING.rst +++ b/HACKING.rst @@ -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. diff --git a/nova/flags.py b/nova/flags.py index 3f356005..476255af 100644 --- a/nova/flags.py +++ b/nova/flags.py @@ -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