_is_opt_registered does identity check
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Fix Released
|
Low
|
Giampaolo Lauria | ||
openstack-common |
Fix Released
|
Wishlist
|
Giampaolo Lauria |
Bug Description
When using _is_opt_registered (of cfg) it seems like there is a identity check that happens here instead of an equality check.
In glance, it was suggested to define the options inside a function, and then register the opt when that function is entered, this of course makes the opt registration blow up, since the option will not be "identically" the same (due to a previous function call occurring with a different opt, that is equivalent but not identical).
This also will happen if opts are defined inside classes (ie anywhere not globally) and that class is constructed twice or a function that defines them is called twice (thus causing duplication option errors).
Possible this line:
if opts[opt.
Should use equality (or check on the names??)
Changed in openstack-common: | |
assignee: | nobody → Giampaolo Lauria (lauria) |
Changed in nova: | |
importance: | Undecided → Low |
Changed in nova: | |
assignee: | nobody → Giampaolo Lauria (lauria) |
status: | New → In Progress |
Changed in openstack-common: | |
milestone: | none → 2012.2 |
status: | Fix Committed → Fix Released |
Changed in nova: | |
status: | In Progress → Fix Released |
This was intentional to avoid registering different option schemas under the same name
Use cases are:
opt = StrOpt('foo')
def do_something(): register_ opt(opt)
CONF.
print CONF.foo
or
class Bar:
opt = StrOpt('foo')
def __init__(self):
CONF. register_ opt(opt)
def do_something(self):
print CONF.foo
However, I'd take a patch to add an equality check, but all fields need to be checked, not just the name