From a32c24ff2ee6dcb60aa92951156206ac3593a0ba Mon Sep 17 00:00:00 2001
From: Maciej Szankin <maciej.szankin@intel.com>
Date: Thu, 2 Jun 2016 09:18:46 -0500
Subject: [PATCH] config options: Improve help for base

This patch improves help text for base related configuration options.

Implements blueprint centralize-config-options-newton

Change-Id: I178d94e5748b572764d4d270c0eabb91d9cb9f0a
---
 nova/conf/base.py | 93 ++++++++++++++++++++++++-----------------------
 1 file changed, 48 insertions(+), 45 deletions(-)

diff --git a/nova/conf/base.py b/nova/conf/base.py
index 6079690d4..e4663fb62 100644
--- a/nova/conf/base.py
+++ b/nova/conf/base.py
@@ -1,10 +1,3 @@
-# needs:fix_opt_description
-# needs:check_deprecation_status
-# needs:check_opt_group_and_type
-# needs:fix_opt_description_indentation
-# needs:fix_opt_registration_consistency
-
-
 # Copyright 2010 United States Government as represented by the
 # Administrator of the National Aeronautics and Space Administration.
 # Copyright 2011 Justin Santa Barbara
@@ -24,68 +17,78 @@
 
 from oslo_config import cfg
 
-notify_decorator = 'nova.notifications.notify_decorator'
-
 base_options = [
-    cfg.IntOpt('password_length',
+    cfg.IntOpt(
+        'password_length',
         default=12,
-        help='Length of generated instance admin passwords'),
-    cfg.StrOpt('instance_usage_audit_period',
+        min=0,
+        help='Length of generated instance admin passwords.'),
+    cfg.StrOpt(
+        'instance_usage_audit_period',
         default='month',
-        help='Time period to generate instance usages for.  '
-             'Time period must be hour, day, month or year'),
-    cfg.BoolOpt('use_rootwrap_daemon',
+        regex='(hour|month|day|year)(@([0-9]+))?',
+        help='''
+Time period to generate instance usages for. It is possible to define optional
+offset to given period by appending @ character followed by a number defining
+offset.
+
+Possible values:
+  *  period, example: ``hour``, ``day``, ``month` or ``year``
+  *  period with offset, example: ``month@15``
+     will result in monthly audits starting on 15th day of month.
+'''),
+    cfg.BoolOpt(
+        'use_rootwrap_daemon',
         default=False,
-        help="Start and use a daemon that can run the commands that "
-        "need to be run with root privileges. This option is "
-        "usually enabled on nodes that run nova compute "
-        "processes"),
-    cfg.StrOpt('rootwrap_config',
+        help='''
+Start and use a daemon that can run the commands that need to be run with
+root privileges. This option is usually enabled on nodes that run nova compute
+processes.
+'''),
+    cfg.StrOpt(
+        'rootwrap_config',
         default="/etc/nova/rootwrap.conf",
-        help='Path to the rootwrap configuration file to use for '
-        'running commands as root'),
+        help='''
+Path to the rootwrap configuration file.
+
+Goal of the root wrapper is to allow a service-specific unprivileged user to
+run a number of actions as the root user in the safest manner possible.
+The configuration file used here must match the one defined in the sudoers
+entry.
+'''),
     cfg.StrOpt(
         'tempdir',
-        help='Explicitly specify the temporary working directory'),
+        help='Explicitly specify the temporary working directory.'),
     cfg.BoolOpt(
         'monkey_patch',
         default=False,
-        help="""Determine if monkey patching should be applied.
+        help="""
+Determine if monkey patching should be applied.
 
-Possible values:
+Related options:
 
-* True: Functions specified in ``monkey_patch_modules`` will be patched.
-* False: No monkey patching will occur.
-
-Services which consume this:
-
-* All
-
-Interdependencies to other options:
-
-* ``monkey_patch_modules``: This must have values set for this option to have
+  * ``monkey_patch_modules``: This must have values set for this option to have
   any effect
 """),
     cfg.ListOpt(
         'monkey_patch_modules',
-        default=[
-            'nova.compute.api:%s' % (notify_decorator)
-        ],
-        help="""List of modules/decorators to monkey patch.
+        default=['nova.compute.api:nova.notifications.notify_decorator'],
+        help="""
+List of modules/decorators to monkey patch.
 
 This option allows you to patch a decorator for all functions in specified
 modules.
 
 Possible values:
 
-* nova.compute.api:nova.notifications.notify_decorator
-* nova.api.ec2.cloud:nova.notifications.notify_decorator
-* [...]
+  * nova.compute.api:nova.notifications.notify_decorator
+  * nova.api.ec2.cloud:nova.notifications.notify_decorator
+  * [...]
 
-Interdependencies to other options:
+Related options:
 
-* ``monkey_patch``: This must be set to ``True`` for this option to
-  have any effect
+  * ``monkey_patch``: This must be set to ``True`` for this option to
+    have any effect
 """),
 ]