Don't convert ValueError to NoSuchOptError in ConfigOpts
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
oslo.config |
Fix Released
|
Low
|
ChangBo Guo(gcb) |
Bug Description
In method __getattr__ of ConfigOpts, we catch all exceptions and convert it to NoSuchOptError, this is wrong.
This is code example and output should raise ValueError , but showing NoSuchOptError.
[gcb@localhost my_code]$ cat test_oslo_config.py
import sys
from oslo_config import cfg
if __name__ == '__main__':
opts = [
]
cfg.
cfg.
virt_type = cfg.CONF.type
print(
[gcb@localhost my_code]$ python test_oslo_config.py
> /usr/lib/
-> if self.quotes and value:
(Pdb) c
Traceback (most recent call last):
File "test_oslo_
virt_type = cfg.CONF.type
File "/usr/lib/
raise NoSuchOptError(
oslo_config.
expected output like:
[gcb@localhost my_code]$ python test_oslo_config.py
Traceback (most recent call last):
File "test_oslo_
virt_type = cfg.CONF.type
File "/usr/lib/
return self._get(name)
File "/usr/lib/
value = self._do_get(name, group, namespace)
File "/usr/lib/
return convert(
File "/usr/lib/
self.
File "/usr/lib/
return opt.type(value)
File "/usr/lib/
repr(value)))
ValueError: Valid values are [kvm, lxc, qemu, uml, xen, parallels], but found 'kvm-x'
Changed in oslo.config: | |
assignee: | nobody → ChangBo Guo(gcb) (glongwave) |
importance: | Undecided → Low |
Changed in oslo.config: | |
status: | New → In Progress |
Changed in oslo.config: | |
status: | In Progress → Fix Committed |
Changed in oslo.config: | |
milestone: | none → 1.15.0 |
status: | Fix Committed → Fix Released |