The config options are an interface to a subset of users. These users need to read and understand the help text of the options. To make it easier to read, it should be possible to preformat the text. This patch set keeps the preformat with line breaks. Change-Id: I8aa871001f7da3cefcd9aa93992d50d0d9140157
3.0 KiB
Style Guide for Help Strings
This document provides style guidance for writing the required help
strings for configuration options using the oslo.config
code.
The help strings are parsed from the code to appear in sample
configuration files, such as etc/cinder/cinder.conf
in the
cinder repository. They are also displayed in the OpenStack
Configuration Reference.
Examples:
cfg.StrOpt('bind_host',
default='0.0.0.0',
help='IP address to listen on.'),
cfg.IntOpt('bind_port',
default=9292,
help='Port number to listen on.')
Style Guide
Use sentence-style capitalization for help strings: Capitalize or uppercase the first character (see the examples above).
Only use single spaces, no double spaces.
Properly capitalize words. If in doubt check the OpenStack Glossary.
End each segment with a period and write complete sentences if possible. Examples:
cfg.StrOpt('osapi_volume_base_URL', default=None, help='Base URL that appears in links to the OpenStack ' 'Block Storage API.') cfg.StrOpt('host', default=socket.gethostname(), help='Name of this node. This can be an opaque identifier. ' 'It is not necessarily a host name, FQDN, or IP address.')
Use valid service names and API names. Valid service names include nova, cinder, swift, glance, heat, neutron, trove, ceilometer, horizon, keystone, and marconi.
Valid API names include Compute API, Image Service API, Identity Service API, Object Storage API, Block Storage API, Database API, and Networking API.
Format
For multi-line strings, remember that strings are concatenated directly and thus spaces need to be inserted normally.
This document recommends to add the space at the end of a line and not at the beginning. Example:
cfg.BoolOpt('glance_api_ssl_compression', default=False, help='Enables or disables negotiation of SSL layer ' 'compression. In some cases disabling compression ' 'can improve data throughput, such as when high ' 'network bandwidth is available and you use ' 'compressed image formats like qcow2.')
It is possible to preformat the multi-line strings to increase readability. Line break characters
\n
will be kept as they are used in the help text. Example:cfg.IntOpt('sync_power_state_interval', default=600, help='Interval to sync power states between the database and ' 'the hypervisor.\n' '\n' '-1: disables the sync \n' ' 0: run at the default rate.\n' '>0: the interval in seconds')