Use choices in config.py

The oslo_config library supports the choices keyword argument. This commit
leverages the use of choices for StrOpts in Keystone's configuration.

Change-Id: Ib276e22e56eff09ac5a43fb7b93170776806fd12
Closes-Bug: 1423973
This commit is contained in:
Lance Bragstad 2015-02-20 17:53:02 +00:00
parent 7121d50627
commit 23bf8c9cb7
2 changed files with 18 additions and 15 deletions

View File

@ -568,18 +568,19 @@ FILE_OPTIONS = {
'Only enable this option if your LDAP server '
'supports subtree deletion.'),
cfg.StrOpt('query_scope', default='one',
help='The LDAP scope for queries, this can be either '
'"one" (onelevel/singleLevel) or "sub" '
'(subtree/wholeSubtree).'),
choices=['one', 'sub'],
help='The LDAP scope for queries, "one" represents '
'oneLevel/singleLevel and "sub" represents '
'subtree/wholeSubtree options.'),
cfg.IntOpt('page_size', default=0,
help='Maximum results per page; a value of zero ("0") '
'disables paging.'),
cfg.StrOpt('alias_dereferencing', default='default',
help='The LDAP dereferencing option for queries. This '
'can be either "never", "searching", "always", '
'"finding" or "default". The "default" option falls '
'back to using default dereferencing configured by '
'your ldap.conf.'),
choices=['never', 'searching', 'always', 'finding',
'default'],
help='The LDAP dereferencing option for queries. The '
'"default" option falls back to using default '
'dereferencing configured by your ldap.conf.'),
cfg.IntOpt('debug_level',
help='Sets the LDAP debugging level for LDAP calls. '
'A value of 0 means that debugging is not enabled. '
@ -801,8 +802,9 @@ FILE_OPTIONS = {
cfg.BoolOpt('use_tls', default=False,
help='Enable TLS for communicating with LDAP servers.'),
cfg.StrOpt('tls_req_cert', default='demand',
help='Valid options for tls_req_cert are demand, never, '
'and allow.'),
choices=['demand', 'never', 'allow'],
help='Specifies what checks to perform on client '
'certificates in an incoming TLS session.'),
cfg.BoolOpt('use_pool', default=False,
help='Enable LDAP connection pooling.'),
cfg.IntOpt('pool_size', default=10,
@ -970,9 +972,10 @@ FILE_OPTIONS = {
cfg.StrOpt('idp_contact_telephone',
help='Telephone number of contact person.'),
cfg.StrOpt('idp_contact_type', default='other',
help='Contact type. Allowed values are: '
'technical, support, administrative '
'billing, and other'),
choices=['technical', 'support', 'administrative',
'billing', 'other'],
help='The contact type describing the main point of '
'contact for the identity provider.'),
cfg.StrOpt('idp_metadata_path',
default='/etc/keystone/saml2_idp_metadata.xml',
help='Path to the Identity Provider Metadata file. '

View File

@ -37,12 +37,12 @@ notifier_opts = [
cfg.StrOpt('default_publisher_id',
help='Default publisher_id for outgoing notifications'),
cfg.StrOpt('notification_format', default='basic',
choices=['basic', 'cadf'],
help='Define the notification format for Identity Service '
'events. A "basic" notification has information about '
'the resource being operated on. A "cadf" notification '
'has the same information, as well as information about '
'the initiator of the event. Valid options are: basic '
'and cadf'),
'the initiator of the event.'),
]
config_section = None