Comment out the rule from generated sample-policy file

blueprint policy-docs

Change-Id: I8077f15c6b231b13c3f96ed5325795958c2cb75f
This commit is contained in:
Anusha Unnam 2017-03-17 15:48:47 +00:00
parent bb33bf3a6d
commit 3951771456
2 changed files with 10 additions and 10 deletions

View File

@ -110,7 +110,7 @@ def _format_rule_default_yaml(default, include_help=True):
{'name': default.name, {'name': default.name,
'check_str': default.check_str}) 'check_str': default.check_str})
if include_help: if include_help:
text = ('%(help)s\n%(text)s\n' % text = ('%(help)s\n#%(text)s\n' %
{'help': _format_help_text(default.description), {'help': _format_help_text(default.description),
'text': text}) 'text': text})
return text return text

View File

@ -89,17 +89,17 @@ class GenerateSampleTestCase(base.PolicyBaseTestCase):
extensions=extensions, namespace=['base_rules', 'rules']) extensions=extensions, namespace=['base_rules', 'rules'])
expected = '''# Basic admin check expected = '''# Basic admin check
"admin": "is_admin:True" #"admin": "is_admin:True"
# This is a long description to check that line wrapping functions # This is a long description to check that line wrapping functions
# properly # properly
"owner": "project_id:%(project_id)s" #"owner": "project_id:%(project_id)s"
# #
"shared": "field:networks:shared=True" #"shared": "field:networks:shared=True"
# #
"admin_or_owner": "rule:admin or rule:owner" #"admin_or_owner": "rule:admin or rule:owner"
''' '''
output_file = self.get_config_file_fullname('policy.yaml') output_file = self.get_config_file_fullname('policy.yaml')
@ -126,17 +126,17 @@ class GenerateSampleTestCase(base.PolicyBaseTestCase):
extensions=extensions, namespace=['base_rules', 'rules']) extensions=extensions, namespace=['base_rules', 'rules'])
expected = '''# Basic admin check expected = '''# Basic admin check
"admin": "is_admin:True" #"admin": "is_admin:True"
# This is a long description to check that line wrapping functions # This is a long description to check that line wrapping functions
# properly # properly
"owner": "project_id:%(project_id)s" #"owner": "project_id:%(project_id)s"
# #
"shared": "field:networks:shared=True" #"shared": "field:networks:shared=True"
# #
"admin_or_owner": "rule:admin or rule:owner" #"admin_or_owner": "rule:admin or rule:owner"
''' '''
stdout = self._capture_stdout() stdout = self._capture_stdout()
@ -168,7 +168,7 @@ class GenerateSampleTestCase(base.PolicyBaseTestCase):
expected = '''# Check Summary expected = '''# Check Summary
# #
# This is a description to check that empty line has no white spaces. # This is a description to check that empty line has no white spaces.
"admin": "is_admin:True" #"admin": "is_admin:True"
''' '''
output_file = self.get_config_file_fullname('policy.yaml') output_file = self.get_config_file_fullname('policy.yaml')