safe get deprecated_reason

when run ./autohelp-wrapper rst aodh, it failed with:
AttributeError: 'BoolOpt' object has no attribute 'deprecated_reason'

we need to check the value before we use it

Change-Id: I362606ba186d1582f850bfa4d602503d6ea5079a
Closes-Bug: #1573953
This commit is contained in:
ZhiQiang Fan 2016-04-24 01:51:38 +08:00
parent 22201b96bf
commit e115fee6a3

View File

@ -464,7 +464,7 @@ def write_files(package_name, options, target, output_format):
if option.deprecated_for_removal:
if not option.help.strip().startswith('DEPRECATED'):
helptext = 'DEPRECATED: ' + helptext
if option.deprecated_reason:
if getattr(option, 'deprecated_reason', None):
helptext += ' ' + option.deprecated_reason
opt_type = _TYPE_DESCRIPTIONS.get(type(option), 'Unknown')