Merge "Add 'DEPRECATED: ' prefix for deprecated opts"
This commit is contained in:
commit
6d176243f3
@ -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)
|
||||
|
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user