Add descriptions for config option choices

oslo.config 5.2.0 changed some of the options
(oslo_config.cfg.StrOpt & PortOpt) so that
the choices parameter will now accept a sequence
of tuples, where each tuple is of the form
(choice, description).

If a description is not provided, the sample
config file is generated with
'<No description provided>' next to the choices.

This adds descriptions to the choices.

Change-Id: I7e32ff8e86d2760af49fd088188b94d19ca76e84
Closes-Bug: #1755914
This commit is contained in:
Ruby Loo 2018-03-14 19:45:23 -04:00
parent af02064a8f
commit 1d38ad8057
9 changed files with 51 additions and 16 deletions

View File

@ -12,6 +12,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from ironic.common.i18n import _
# NOTE(xek): This decides the version cap of RPC messages sent to conductor
# and objects during rolling upgrades, when [DEFAULT]/pin_release_version
# configuration is set.
@ -130,6 +133,9 @@ RELEASE_MAPPING['queens'] = RELEASE_MAPPING['10.1']
# List of available versions with named versions first; 'master' is excluded.
RELEASE_VERSIONS = sorted(set(RELEASE_MAPPING) - {'master'}, reverse=True)
# List of available (version, description) tuples.
RELEASE_VERSIONS_DESCS = [(v, _('"%s" release') % v) for v in RELEASE_VERSIONS]
def get_object_versions(releases=None, objects=None):
"""Gets the supported versions for all objects.

View File

@ -58,12 +58,17 @@ opts = [
help=_('API version to use for communicating with the ramdisk '
'agent.')),
cfg.StrOpt('deploy_logs_collect',
choices=['always', 'on_failure', 'never'],
choices=[('always', _('always collect the logs')),
('on_failure', _('only collect logs if there is a '
'failure')),
('never', _('never collect logs'))],
default='on_failure',
help=_('Whether Ironic should collect the deployment logs on '
'deployment failure (on_failure), always or never.')),
cfg.StrOpt('deploy_logs_storage_backend',
choices=['local', 'swift'],
choices=[('local', _('store the logs locally')),
('swift', _('store the logs in Object Storage '
'service'))],
default='local',
help=_('The name of the storage backend where the logs '
'will be stored.')),

View File

@ -56,7 +56,9 @@ api_opts = [
cfg.StrOpt(
'auth_strategy',
default='keystone',
choices=['noauth', 'keystone'],
choices=[('noauth', _('no authentication')),
('keystone', _('use the Identity service for '
'authentication'))],
help=_('Authentication strategy used by ironic-api. "noauth" should '
'not be used in a production environment because all '
'authentication will be disabled.')),
@ -240,7 +242,11 @@ netconf_opts = [
# default for options without set defaults that aren't required.
notification_opts = [
cfg.StrOpt('notification_level',
choices=['debug', 'info', 'warning', 'error', 'critical'],
choices=[('debug', _('"debug" level')),
('info', _('"info" level')),
('warning', _('"warning" level')),
('error', _('"error" level')),
('critical', _('"critical" level'))],
help=_('Specifies the minimum level for which to send '
'notifications. If not set, no notifications will '
'be sent. The default is for this option to be unset.'))
@ -281,7 +287,7 @@ service_opts = [
'an AMQP key, and if using ZeroMQ, a valid '
'hostname, FQDN, or IP address.')),
cfg.StrOpt('pin_release_version',
choices=versions.RELEASE_VERSIONS,
choices=versions.RELEASE_VERSIONS_DESCS,
mutable=True,
help=_('Used for rolling upgrades. Setting this option '
'downgrades (or pins) the Bare Metal API, '

View File

@ -66,7 +66,8 @@ opts = [
help=_('Whether to power off a node after deploy failure. '
'Defaults to True.')),
cfg.StrOpt('default_boot_option',
choices=['netboot', 'local'],
choices=[('netboot', _('boot from a network')),
('local', _('local boot'))],
help=_('Default boot option to use when no boot option is '
'requested in node\'s driver_info. Currently the '
'default is "netboot", but it will be changed to '
@ -83,7 +84,8 @@ opts = [
default='swift',
deprecated_group='glance',
deprecated_name='temp_url_endpoint_type',
choices=['swift', 'radosgw'],
choices=[('swift', _('use Object Storage service')),
('radosgw', _('use RADOS object store'))],
help=_('Type of object store endpoint type to be '
'used as a backend')),
]

View File

@ -127,7 +127,9 @@ opts = [
'glance.')),
cfg.StrOpt('auth_strategy',
default='keystone',
choices=['keystone', 'noauth'],
choices=[('keystone', _('use the Identity service for '
'authentication')),
('noauth', _('no authentication'))],
deprecated_for_removal=True,
deprecated_reason=_("To configure glance in noauth mode, "
"set [glance]/auth_type=none and "

View File

@ -74,7 +74,10 @@ opts = [
help=_('CA certificate file to validate iLO.')),
cfg.StrOpt('default_boot_mode',
default='auto',
choices=['auto', 'bios', 'uefi'],
choices=[('auto', _('based on boot mode settings on the '
'system')),
('bios', _('BIOS boot mode')),
('uefi', _('UEFI boot mode'))],
help=_('Default boot mode to be used in provisioning when '
'"boot_mode" capability is not provided in the '
'"properties/capabilities" of the node. The default is '

View File

@ -25,7 +25,9 @@ opts = [
help=_('IP of remote image server')),
cfg.StrOpt('remote_image_share_type',
default='CIFS',
choices=['CIFS', 'NFS'],
choices=[('CIFS', _('CIFS (Common Internet File System) '
'protocol')),
('NFS', _('NFS (Network File System) protocol'))],
ignore_case=True,
help=_('Share type of virtual media')),
cfg.StrOpt('remote_image_share_name',
@ -40,11 +42,13 @@ opts = [
help=_('Domain name of remote_image_user_name')),
cfg.PortOpt('port',
default=443,
choices=[443, 80],
choices=[(443, _('port 443')),
(80, _('port 80'))],
help=_('Port to be used for iRMC operations')),
cfg.StrOpt('auth_method',
default='basic',
choices=['basic', 'digest'],
choices=[('basic', _('Basic authentication')),
('digest', _('Digest authentication'))],
help=_('Authentication method to be used for iRMC '
'operations')),
cfg.IntOpt('client_timeout',
@ -52,11 +56,15 @@ opts = [
help=_('Timeout (in seconds) for iRMC operations')),
cfg.StrOpt('sensor_method',
default='ipmitool',
choices=['ipmitool', 'scci'],
choices=[('ipmitool', _('IPMItool')),
('scci', _('Fujitsu SCCI (ServerView Common Command '
'Interface)'))],
help=_('Sensor data retrieval method.')),
cfg.StrOpt('snmp_version',
default='v2c',
choices=['v1', 'v2c', 'v3'],
choices=[('v1', _('SNMPv1')),
('v2c', _('SNMPv2c')),
('v3', _('SNMPv3'))],
help=_('SNMP protocol version')),
cfg.PortOpt('snmp_port',
default=161,

View File

@ -49,7 +49,9 @@ opts = [
help=_('Client retries in the case of a failed request.')),
cfg.StrOpt('auth_strategy',
default='keystone',
choices=['keystone', 'noauth'],
choices=[('keystone', _('use the Identity service for '
'authentication')),
('noauth', _('no authentication'))],
deprecated_for_removal=True,
deprecated_reason=_("To configure neutron for noauth mode, "
"set [neutron]/auth_type = none and "

View File

@ -113,7 +113,8 @@ opts = [
'via iPXE. Defaults to 0 (no timeout)')),
cfg.StrOpt('ip_version',
default='4',
choices=['4', '6'],
choices=[('4', _('IPv4')),
('6', _('IPv6'))],
help=_('The IP version that will be used for PXE booting. '
'Defaults to 4. EXPERIMENTAL')),
cfg.BoolOpt('ipxe_use_swift',