Remove the sample policy file

The sample file has been empty for a little while now since default
policies are registered in code. Shipping an empty file may be
confusing, so let's remove it. A README has been added explaining how to
generate an actual sample policy file.

Change-Id: I23c934d2b610a451d6ebbd4276721c455365cedc
Depends-On: I85a251376dfe38caa4b100861bf764014a98bc37
This commit is contained in:
Andrew Laski 2016-09-28 14:11:02 -04:00
parent d5f113de34
commit d17a20d3d7
3 changed files with 4 additions and 15 deletions

View File

@ -0,0 +1,4 @@
To generate the sample policy.json file, run the following command from the top
level of the nova directory:
tox -egenpolicy

View File

@ -1,2 +0,0 @@
{
}

View File

@ -537,19 +537,6 @@ class RealRolePolicyTestCase(test.NoDBTestCase):
policy.authorize(self.non_admin_context, rule,
{'project_id': 'fake', 'user_id': 'fake'})
def test_no_empty_rules(self):
# Parsed rules substitute '@' for '', so we need to look at the raw
# policy definitions
# CONF.oslo_policy.policy_file has been set to the sample file by
# the RealPolicyFixture used in setUp
with open(CONF.oslo_policy.policy_file, 'r') as policy_file:
policy_dict = jsonutils.loads(policy_file.read())
for rule_name, rule in policy_dict.items():
self.assertNotEqual('', str(rule),
'%s should not be empty, use "@" instead if the policy '
'should allow everything' % rule_name)
def test_allow_all_rules(self):
for rule in self.allow_all_rules:
policy.authorize(self.non_admin_context, rule, self.target)