Merge "Add 'DEPRECATED: ' prefix for deprecated opts"

This commit is contained in:
Jenkins 2016-05-14 13:43:24 +00:00 committed by Gerrit Code Review
commit 6d176243f3
2 changed files with 11 additions and 5 deletions

View File

@ -171,8 +171,14 @@ 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,
help_text = u'%s%s (%s)' % (opt_prefix,
opt.help,
opt_type)
else:
help_text = u'(%s)' % opt_type

View File

@ -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.