summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-05-14 13:43:24 +0000
committerGerrit Code Review <review@openstack.org>2016-05-14 13:43:24 +0000
commit6d176243f398bf7e5d6bd8a5382945f2c5e318c3 (patch)
treed4d0e1fe7861e1412dd5ebcf9d4f67558530fef9
parentcd16e52be22aa203557b9a6be5c1b45977f690db (diff)
parent634012761e422d6f0fdd69021b4e6407826c7b4a (diff)
downloadoslo-config-6d176243f398bf7e5d6bd8a5382945f2c5e318c3.tar.gz
Merge "Add 'DEPRECATED: ' prefix for deprecated opts"3.10.0
-rw-r--r--oslo_config/generator.py10
-rw-r--r--oslo_config/tests/test_generator.py6
2 files changed, 11 insertions, 5 deletions
diff --git a/oslo_config/generator.py b/oslo_config/generator.py
index 3654e4a..ed66cf0 100644
--- a/oslo_config/generator.py
+++ b/oslo_config/generator.py
@@ -171,9 +171,15 @@ class _OptFormatter(object):
option_type = getattr(opt, 'type', None)
opt_type = getattr(option_type, 'type_name', 'unknown value')
+ opt_prefix = ''
+ if (opt.deprecated_for_removal and
+ not opt.help.startswith('DEPRECATED')):
+ opt_prefix = 'DEPRECATED: '
+
if opt.help:
- help_text = u'%s (%s)' % (opt.help,
- opt_type)
+ help_text = u'%s%s (%s)' % (opt_prefix,
+ opt.help,
+ opt_type)
else:
help_text = u'(%s)' % opt_type
lines = self._format_help(help_text)
diff --git a/oslo_config/tests/test_generator.py b/oslo_config/tests/test_generator.py
index 7e63824..ae3b36c 100644
--- a/oslo_config/tests/test_generator.py
+++ b/oslo_config/tests/test_generator.py
@@ -91,7 +91,7 @@ class GeneratorTestCase(base.BaseTestCase):
deprecated_for_removal=True,
deprecated_reason='This was supposed to work but it really, '
'really did not. Always buy house insurance.',
- help='Turn off stove'),
+ help='DEPRECATED: Turn off stove'),
'deprecated_group': cfg.StrOpt('bar',
deprecated_group='group1',
deprecated_name='foobar',
@@ -427,7 +427,7 @@ class GeneratorTestCase(base.BaseTestCase):
# From test
#
-# deprecated for removal (string value)
+# DEPRECATED: deprecated for removal (string value)
# This option is deprecated for removal.
# Its value may be silently ignored in the future.
#bar = <None>
@@ -445,7 +445,7 @@ class GeneratorTestCase(base.BaseTestCase):
# From test
#
-# Turn off stove (boolean value)
+# DEPRECATED: Turn off stove (boolean value)
# This option is deprecated for removal.
# Its value may be silently ignored in the future.
# Reason: This was supposed to work but it really, really did not.