[gcb@localhost my_code]$ python test_oslo_config.py
> /usr/lib/python2.7/site-packages/oslo_config/types.py(57)__call__()
-> if self.quotes and value:
(Pdb) c
Traceback (most recent call last):
File "test_oslo_config.py", line 14, in <module>
virt_type = cfg.CONF.type
File "/usr/lib/python2.7/site-packages/oslo_config/cfg.py", line 1870, in __getattr__
raise NoSuchOptError(name)
oslo_config.cfg.NoSuchOptError: no such option: type
I'm also fixing bug https://bugs.launchpad.net/bugs/1471149 , that will result like
[gcb@localhost my_code]$ python test_oslo_config.py
Traceback (most recent call last):
File "test_oslo_config.py", line 14, in <module>
virt_type = cfg.CONF.type
File "/usr/lib/python2.7/site-packages/oslo_config/cfg.py", line 1868, in __getattr__
return self._get(name)
File "/usr/lib/python2.7/site-packages/oslo_config/cfg.py", line 2240, in _get
value = self._do_get(name, group, namespace)
File "/usr/lib/python2.7/site-packages/oslo_config/cfg.py", line 2296, in _do_get
return convert(opt.default)
File "/usr/lib/python2.7/site-packages/oslo_config/cfg.py", line 2272, in convert
self._substitute(value, group, namespace), opt)
File "/usr/lib/python2.7/site-packages/oslo_config/cfg.py", line 2341, in _convert_value
return opt.type(value)
File "/usr/lib/python2.7/site-packages/oslo_config/types.py", line 68, in __call__
repr(value)))
ValueError: Valid values are [kvm, lxc, qemu, uml, xen, parallels], but found 'kvm-x'
an example the usage of choices:
[gcb@localhost my_code]$ cat test_oslo_config.py
import sys
from oslo_config import cfg
if __name__ == '__main__':
cfg.StrOpt( 'type',
default= 'kvm-x' ,
choices= ('kvm', 'lxc', 'qemu', 'uml', 'xen', 'parallels'),
help= 'Libvirt domain type'),
opts = [
]
cfg. CONF.register_ opts(opts) CONF(sys. argv[1: ], project='test', version='0.1', default_ config_ files=None) virt_type)
cfg.
virt_type = cfg.CONF.type
print(
[gcb@localhost my_code]$ python test_oslo_config.py python2. 7/site- packages/ oslo_config/ types.py( 57)__call_ _() config. py", line 14, in <module> python2. 7/site- packages/ oslo_config/ cfg.py" , line 1870, in __getattr__ name) cfg.NoSuchOptEr ror: no such option: type
> /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.
I'm also fixing bug https:/ /bugs.launchpad .net/bugs/ 1471149 , that will result like config. py", line 14, in <module> python2. 7/site- packages/ oslo_config/ cfg.py" , line 1868, in __getattr__ python2. 7/site- packages/ oslo_config/ cfg.py" , line 2240, in _get python2. 7/site- packages/ oslo_config/ cfg.py" , line 2296, in _do_get opt.default) python2. 7/site- packages/ oslo_config/ cfg.py" , line 2272, in convert _substitute( value, group, namespace), opt) python2. 7/site- packages/ oslo_config/ cfg.py" , line 2341, in _convert_value python2. 7/site- packages/ oslo_config/ types.py" , line 68, in __call__
[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'