Tong Damon Da f1f972aeb7 make registering a cli opt on a filter object work.
Change the behaviour of ConfigFilter.register_cli_opt to:

1. If the opt is already registered before parsing, then registering
just import it.
2. if the opt is not registered before, then raise an exception named

CliOptRegisteredError.
By adding this modification, the behaviour of
ConfigFilter.register_cli_opt looks more consistent to
ConfigOpts.register_cli_opt. The solution to the question mentioned in
Bug#1366946 should be like this:

from oslo_config import cfg
from oslo_config import cfgfilter

import sys

c = cfg.CONF
c.register_cli_opt(
cfg.BoolOpt('myflag',
default=False,
help='turn on myflag',
)
)
c(sys.argv[1:])

f = cfgfilter.ConfigFilter(c)
f.register_cli_opt(
cfg.BoolOpt('myflag',
default=False,
help='turn on myflag',
)
)

print f.myflag

Closes-Bug: #1366946
Change-Id: I94df9409f72807461370b4aaf8eb2543c52a89bb
2015-05-23 12:39:12 +08:00
2015-05-13 11:22:21 +02:00
2013-03-14 12:04:19 -07:00
2013-05-03 17:26:07 -04:00
2013-02-17 09:25:32 +00:00
2013-06-13 10:39:54 +02:00
2015-04-07 09:14:02 -07:00
2014-04-30 02:45:43 +00:00

Oslo Configuration Library

Latest Version

Downloads

The Oslo configuration API supports parsing command line arguments and .ini style configuration files.

Description
OpenStack library for config
Readme 12 MiB
Languages
Python 99.8%
Shell 0.2%