summaryrefslogtreecommitdiff
path: root/oslo_policy/generator.py
diff options
context:
space:
mode:
authorLance Bragstad <lbragstad@gmail.com>2018-06-01 21:25:19 +0000
committerLance Bragstad <lbragstad@gmail.com>2018-06-01 21:25:19 +0000
commit0f31938dd720015444e03f0056c0cfc0e4b8e932 (patch)
tree72894680980555a7ec97dec0339bab438519fdf9 /oslo_policy/generator.py
parentba836f2d409ecab61103cf859446c12322f99952 (diff)
downloadoslo-policy-0f31938dd720015444e03f0056c0cfc0e4b8e932.tar.gz
Remove erroneous newline in sample generation
The sample generation code for policies has a couple different cases that make sure deprecated rules have descriptions and reasoning formatted in the comment section. One of the cases that handles policies deprecated for removal was injecting an extra newline in the comment text that threw off the formatting of the sample, leaving the subsequent policy uncommented, and visually unpleasing. This commit removes the extra newline in the formatting logic for deprecated policies and adds a test case for the behavior. Change-Id: I76338d2fbaccf3b43e0da04732fd9df3c05dfbda Closes-Bug: 1771442
Diffstat (limited to 'oslo_policy/generator.py')
-rw-r--r--oslo_policy/generator.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/oslo_policy/generator.py b/oslo_policy/generator.py
index 38c9b5b..6694559 100644
--- a/oslo_policy/generator.py
+++ b/oslo_policy/generator.py
@@ -136,8 +136,7 @@ def _format_rule_default_yaml(default, include_help=True):
if default.deprecated_for_removal:
text = (
'# DEPRECATED\n# "%(name)s" has been deprecated since '
- '%(since)s.\n%(reason)s\n%(text)s\n'
- '"%(name)s": "%(check_str)s"'
+ '%(since)s.\n%(reason)s\n%(text)s'
) % {'name': default.name,
'check_str': default.check_str,
'since': default.deprecated_since,