From d17a20d3d70453f327cd45b538db2fb5c1958cd9 Mon Sep 17 00:00:00 2001 From: Andrew Laski Date: Wed, 28 Sep 2016 14:11:02 -0400 Subject: [PATCH] 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 --- etc/nova/README-policy.json.txt | 4 ++++ etc/nova/policy.json | 2 -- nova/tests/unit/test_policy.py | 13 ------------- 3 files changed, 4 insertions(+), 15 deletions(-) create mode 100644 etc/nova/README-policy.json.txt delete mode 100644 etc/nova/policy.json diff --git a/etc/nova/README-policy.json.txt b/etc/nova/README-policy.json.txt new file mode 100644 index 000000000000..23b64bea9536 --- /dev/null +++ b/etc/nova/README-policy.json.txt @@ -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 diff --git a/etc/nova/policy.json b/etc/nova/policy.json deleted file mode 100644 index 2c63c0851048..000000000000 --- a/etc/nova/policy.json +++ /dev/null @@ -1,2 +0,0 @@ -{ -} diff --git a/nova/tests/unit/test_policy.py b/nova/tests/unit/test_policy.py index 0238ac584938..22eb66c57f5b 100644 --- a/nova/tests/unit/test_policy.py +++ b/nova/tests/unit/test_policy.py @@ -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)