From 90da88cce51bccd320e89141ed7384d2e7ccca9d Mon Sep 17 00:00:00 2001 From: Giampaolo Lauria Date: Fri, 20 Jul 2012 16:41:45 -0400 Subject: Modifies _is_opt_registered fcn to check for duplicate opts This change fixes bug 999307 Currently, the check for duplicate options is done by checking whether they are the same object. The proposed fix is to check whether all the object fields have the same value. Change-Id: I2b72d630a0c8821df1d81e25d316d8d9195be492 --- openstack/common/cfg.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'openstack') diff --git a/openstack/common/cfg.py b/openstack/common/cfg.py index 109bc28..728ecdc 100644 --- a/openstack/common/cfg.py +++ b/openstack/common/cfg.py @@ -464,7 +464,7 @@ def _is_opt_registered(opts, opt): :raises: DuplicateOptError if a naming conflict is detected """ if opt.dest in opts: - if opts[opt.dest]['opt'] is not opt: + if opts[opt.dest]['opt'] != opt: raise DuplicateOptError(opt.name) return True else: @@ -527,6 +527,9 @@ class Opt(object): else: self.deprecated_name = None + def __ne__(self, another): + return vars(self) != vars(another) + def _get_from_config_parser(self, cparser, section): """Retrieves the option value from a MultiConfigParser object. -- cgit