diff options
Diffstat (limited to 'oslo_policy/generator.py')
-rw-r--r-- | oslo_policy/generator.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/oslo_policy/generator.py b/oslo_policy/generator.py index 1ea768e..bd75389 100644 --- a/oslo_policy/generator.py +++ b/oslo_policy/generator.py @@ -193,12 +193,19 @@ def _format_rule_default_yaml(default, include_help=True): 'check_str': default.check_str, 'reason': default.deprecated_reason} - text = ( - '%(text)s%(deprecated_text)s\n"%(old_name)s": "rule:%(name)s"\n' - ) % {'text': text, - 'deprecated_text': _format_help_text(deprecated_text), - 'old_name': default.deprecated_rule.name, - 'name': default.name} + if default.name != default.deprecated_rule.name: + text = ( + '%(text)s%(deprecated_text)s\n"%(old_name)s": "rule:%(name)s"' + '\n' + ) % {'text': text, + 'deprecated_text': _format_help_text(deprecated_text), + 'old_name': default.deprecated_rule.name, + 'name': default.name} + else: + text = ( + '%(text)s%(deprecated_text)s\n' + ) % {'text': text, + 'deprecated_text': _format_help_text(deprecated_text)} return text |