Stop using cfg's internal implementation details

The fact that a cfg opt register using register_opt() is available via
the command line is actually a bug (see bug #1082279).

Also, using the _cli_values attribute is clearly poking into private
implementation details.

Fix both issues by registering the opt using register_cli_opt() and
accessing its value the normal way.

Change-Id: If170dcd96daae5b4c3d7cdebed914df417c2209b
This commit is contained in:
Mark McLoughlin 2012-11-26 16:16:54 +00:00
parent 07c1aafdf2
commit 904af119d2
2 changed files with 4 additions and 2 deletions

View File

@ -90,7 +90,7 @@ if __name__ == '__main__':
CONF.print_help()
sys.exit(1)
monkeypatch_thread = not CONF._cli_values['standard_threads']
monkeypatch_thread = not CONF.standard_threads
eventlet.patcher.monkey_patch(all=False, socket=True, time=True,
thread=monkeypatch_thread)

View File

@ -122,6 +122,9 @@ def register_cli_int(*args, **kw):
group = kw.pop('group', None)
return conf.register_cli_opt(cfg.IntOpt(*args, **kw), group=group)
register_cli_bool('standard-threads', default=False)
register_str('admin_token', default='ADMIN')
register_str('bind_host', default='0.0.0.0')
register_str('compute_port', default=8774)
@ -129,7 +132,6 @@ register_str('admin_port', default=35357)
register_str('public_port', default=5000)
register_str('onready')
register_str('auth_admin_prefix', default='')
register_bool('standard-threads', default=False)
register_str('policy_file', default='policy.json')
register_str('policy_default_rule', default=None)