Commit Graph

336 Commits

Author SHA1 Message Date
Andreas Jaeger 58ff5e6f4c Retire repo
This repo was created by accident, use deb-python-oslo.policy
instead.

Needed-By: I1ac1a06931c8b6dd7c2e73620a0302c29e605f03
Change-Id: I81894aea69b9d09b0977039623c26781093a397a
2017-04-17 19:38:30 +02:00
Tony Breeds 804be59795 Revert "Adds debug logging for policy file validation"
This reverts commit 5273d2c3a1.

The commit in question more nearly doubles the .testrepository runs:

 -rw------- 1 stack stack 50M Aug  9 05:29 0
 -rw------- 1 stack stack 36M Aug  9 05:46 1

0 == keystone py27 with olso.policy 1.13.0
1 == keystone py27 with olso.policy 1.12.0

This can be seen in the gate[1][2].  Revert the debuging change until it can be
off by defult and used when needed.

[1] http://logs.openstack.org/97/350197/2/check/gate-cross-keystone-python27-db-ubuntu-xenial/16c26fa/console.html#_2016-08-08_22_53_48_974404
[2] And it's preventing olso.policy 1.13.0 being used in upper-constraints.txt

Change-Id: I19a73e8935976cc98398665306cc104b66719951
2016-08-09 16:04:19 +10:00
OpenStack Proposal Bot 1d2b26d7b5 Updated from global requirements
Change-Id: Ib4398ab22db8930d9ac4cf08f36b31dea8b1a1b6
2016-08-04 02:40:49 +00:00
Jenkins 43587dec7e Merge "Allow policy file to not exist" 2016-08-03 09:49:49 +00:00
Wei Li b82bfe041c Delete H803 in flake8 ignore
In hacking >= 0.10.0,do not have H803.So we should delete
it in flake8 ignore list.

Change-Id: Ife2b05586211b574eb87412f922e1a5d0ef75b0b
2016-08-02 19:34:19 +08:00
OpenStack Proposal Bot 10a81baefa Updated from global requirements
Change-Id: I924b370ccf0af8350c2db6fa84bff2eaa79e27da
2016-07-29 02:33:58 +00:00
Jenkins 90ed0adce7 Merge "Add note about not all APIs support policy enforcement by user_id" 2016-07-21 23:18:17 +00:00
He Jie Xu cce967ad09 Add note about not all APIs support policy enforcement by user_id
The policy enforcement by user_id on some of API resources was untested.
This patch adds note about not all API resource support policy
enforcement by user_id or project_id.

Discussion:
http://lists.openstack.org/pipermail/openstack-operators/2016-May/010528.html

Change-Id: I6e5c77981d7acbee73ebf10b6d8bdecab4e83bb3
2016-07-21 04:23:24 +08:00
Jenkins e12ae8bd0c Merge "Adds debug logging for policy file validation" 2016-07-20 20:07:15 +00:00
Andrew Laski 5a651339d6 Allow policy file to not exist
Now that policy rules can be registered in code there is a desire to run
projects without a policy file. However oslo.policy assumed a policy
file would exist and would raise an error if it could not be found. This
changes that behavior to not error if a policy file is not found.

Because there are now tools which can generate policy files which list
the defaults, or list the effective policy there is no requirement that
a policy file be used in order to examine the policy that is in use. So
it should be possible to run without one.

Change-Id: Ia82df77f7a65aa1f3e3eaa7ed949103fa73fb603
2016-07-14 12:23:08 -04:00
Kseniya Tychkova 5273d2c3a1 Adds debug logging for policy file validation
Simple solution to make debug easier

Change-Id: Ie5704f444b22f32876156277595408424c0ac38e
Closes-Bug: 1588552
2016-07-13 14:39:56 +03:00
Jenkins ab8cbd187f Merge "Add Python 3.5 classifier and venv" 2016-07-13 00:38:07 +00:00
Adrian Vladu 09c55883a1 Fixed unit tests running on Windows
Replaced all slashes in the paths with os.path.join,
so that they are compatible with Windows and Linux.

Change-ID: I04125bb3305f695e156e901543393abfae527acc
2016-07-12 13:59:43 +03:00
ChangBo Guo(gcb) 72043117a0 Add Python 3.5 classifier and venv
Now that there is a passing gate job, we can claim support for
Python 3.5 in the classifier. This patch also adds the convenience
py35 venv.

Change-Id: I712c4e32e4db3e5ef826c69a11b8c3338753906f
2016-07-12 16:40:47 +08:00
OpenStack Proposal Bot cbb0824b56 Updated from global requirements
Change-Id: I295cbacfcf5e68b811920992a13d22435601683f
2016-07-09 19:25:58 +00:00
OpenStack Proposal Bot d0d39a4618 Updated from global requirements
Change-Id: I92f5e86ef3a0a14eb55e0d4cc1134d2ec33da54d
2016-07-09 03:16:17 +00:00
Andrew Laski 202340cebd Fix mispelled method name in setup.cfg
The oslopolicy-policy-generator script was configured to use a method
named genarate_policy. Unfortunately that method does not exist but
there is one called generate_policy. This fixes the mistake.

Change-Id: I04125bb3305f695e156e901543393abfae527a09
2016-07-06 15:08:57 -04:00
OpenStack Proposal Bot a7a51bc1c9 Updated from global requirements
Change-Id: I929f57c4d6c72df0386ea87ae1edd49d1e2ae16f
2016-06-30 18:48:30 +00:00
OpenStack Proposal Bot 7e114b68d0 Updated from global requirements
Change-Id: I5daf4add079c41a6bb98b53b687fb8ed53c508b0
2016-06-29 18:08:07 +00:00
OpenStack Proposal Bot 123c1555fc Imported Translations from Zanata
For more information about this automatic import see:
https://wiki.openstack.org/wiki/Translations/Infrastructure

Change-Id: I5e6ef88add5dd799ffc65f10e91d61b7c1f9e67a
2016-06-29 07:56:46 +00:00
OpenStack Proposal Bot db9711de55 Updated from global requirements
Change-Id: I9c467fc429143a81948988201940fcab69965008
2016-06-21 18:04:31 +00:00
OpenStack Proposal Bot 6aa8551aa4 Imported Translations from Zanata
For more information about this automatic import see:
https://wiki.openstack.org/wiki/Translations/Infrastructure

Change-Id: Ic28384fe1b8d981974ef6633c0a08c089fa45f95
2016-06-11 07:50:13 +00:00
Jenkins 714180716b Merge "Improve policy sample generation testing" 2016-06-11 00:23:18 +00:00
Andrew Laski 9050c428d6 Improve policy sample generation testing
The tests for policy sample generation were replacing
stevedore.named.NamedExtensionManager with a mock. This allows tests to
form a mock with a different api than NamedExtensionManager and run code
against that, which may pass the test and then fail when a real
NamedExtensionManager is used. Instead a
NamedExtensionManager.make_test_instance() should be returned which
enforces the same api as NamedExtensionManager and would cause a test
failure if used improperly.

Change-Id: I6db1b92fd90956f727a6422524623aee73f8c416
2016-06-08 15:27:52 -04:00
Andrew Laski 85ebe9eb5f Add helper scripts for generating policy info
This adds two helper scripts that consuming projects can use to get
information that helps deployers.

The oslopolicy-policy-generator script looks at an entry_point for a
configured policy.Enforcer and outputs a yaml formatted policy file for
that configuration. This is a merge of registered rules and configured
rules.

The oslopolicy_list_redundant script looks at an entry_point for a
configured policy.Enforcer and outputs a yaml formatted policy file with
a list of policies where the registered default matches the project
configuration. These are policies that can be removed from the
configuration file(s) without affecting policy.

Change-Id: Ibe4e6c9288768bcc8f532e384524580c57e58275
Implements: bp policy-sample-generation
2016-06-08 15:12:53 -04:00
Andrew Laski 474c120ae6 Add sample file generation script and helper methods
This adds a console script to oslo.policy that will output a sample
policy file in yaml format. It works by looking at the configured
namespace(s) under an 'oslo.policy.policies' entry point. A method, or
methods, should be provided which return a list of
oslo_policy.policy.RuleDefault objects.

To use this script add an entry to setup.cfg in a project with something
like:

oslo.policy.policies =
    nova.api = nova.api.opts:list_policies

list_policies should be a method which returns a list of
oslo_policy.policy.RuleDefault objects.

Then run it like:

oslopolicy-sample-generator --namespace nova.api

--output-file can also be specified, or those options can be configured
in a file which can be specified with --config-file.

Change-Id: If25d48313b91a6610119220e13f635c6e28b2a59
Partially-Implements: bp policy-sample-generation
2016-06-06 10:12:04 -04:00
Andrew Laski ea29939194 Add equality operator to policy.RuleDefault
There are occasions when comparing two RuleDefault objects is needed.
Rather than embedding the logic at the comparison site it's preferable
to let the object know how to compare itself to another.

Change-Id: I2eae5665fdecd6638e84f577b506314f7bc03fd3
2016-06-06 10:11:50 -04:00
OpenStack Proposal Bot f5988a2596 Imported Translations from Zanata
For more information about this automatic import see:
https://wiki.openstack.org/wiki/Translations/Infrastructure

Change-Id: I497b49d36eabca37ce64c57dfc77a6731c3b48a5
2016-06-04 07:01:40 +00:00
OpenStack Proposal Bot 88bcd97575 Updated from global requirements
Change-Id: Ia206c725686347c3ce63cfe91e644296fc3813eb
2016-06-03 18:18:06 +00:00
Edan David 5046c53fa6 Fix typo: 'olso' to 'oslo'
Change-Id: I58d28adf06e778307370fe580a1449659aedecc2
2016-06-02 01:35:37 -04:00
OpenStack Proposal Bot 8c3acab47b Updated from global requirements
Change-Id: Id3d3d8966f256009c33636b9169e0f286776d178
2016-06-01 13:53:18 +00:00
OpenStack Proposal Bot 3e7f7d4ec4 Updated from global requirements
Change-Id: I93d7566f51b01576d70c3eba0434c298166f2846
2016-05-31 03:05:24 +00:00
Jenkins 5c2b6ab2c4 Merge "Add reno for release notes management" 2016-05-23 09:30:47 +00:00
Kirill Bespalov fd785d2bb6 Add reno for release notes management
An initial patch to add reno and create a base directory for
release notes

Change-Id: If7aeb47ca244cfe03a34b8b8a80f0075de5f4b02
2016-05-20 18:08:13 +03:00
Jenkins 65f93657dc Merge "Add policy registration and authorize method" 2016-05-19 20:47:22 +00:00
Andrew Laski bb11272326 Add policy registration and authorize method
A new RuleDefault class has been added which can be used to register
policies that will be used by a consumer of oslo.policy. These policies
are merged with those defined in policy files, with the file definitions
overriding the defaults

Registering a policy with the same name twice is considered an error and
will raise a DuplicateRuleDefaultError exception.

To facilitate projects wishing to ensure that all policies are
registered before use an authorize method has been added which errors
when checking an unregistered policy. If the policy has been registered
then the enforce method is called in the normal manner.

Change-Id: I3b6423aeed8ae80e8bf73dbda0f63ef379ccef43
Implements: bp policy-in-code
2016-05-19 12:20:37 -04:00
OpenStack Proposal Bot f5ee730a64 Updated from global requirements
Change-Id: Iddbee6964b25bbd03ff4f0a51eb6f2c1e04bf699
2016-05-17 18:05:10 +00:00
ChangBo Guo(gcb) 3da2f4aad2 doc: Fix wrong import statement in usage
We should import cfg from oslo_config, not keystone.

Change-Id: I79e3dc573727400d1f6f6474c221726796a6ece2
2016-05-17 19:59:46 +08:00
ChangBo Guo(gcb) 5a8969c97b Trivial: ignore openstack/common in flake8 exclude list
The directory openstack/common doesn't exist any more.
So remove it from flake8 exclude list.

Change-Id: Ib6b1714ab24aae952081e519609e5e99cf4babc2
2016-05-11 20:38:13 +08:00
OpenStack Proposal Bot 93aee73d37 Updated from global requirements
Change-Id: I110883319216fefb1fc8cb8ae663eb946d78d062
2016-04-28 16:16:13 +00:00
OpenStack Proposal Bot 9536d53cf1 Imported Translations from Zanata
For more information about this automatic import see:
https://wiki.openstack.org/wiki/Translations/Infrastructure

Change-Id: I9b3bf7c6d8088333b4bf09b46f87625792296c2a
2016-04-25 06:52:15 +00:00
Jenkins 9766b49a9f Merge "Deprecate load_json() in favor of load()" 2016-04-24 22:21:31 +00:00
Jenkins 3e9883ada7 Merge "Support policy file in YAML" 2016-04-24 22:20:07 +00:00
OpenStack Proposal Bot cc9f17d84f Imported Translations from Zanata
For more information about this automatic import see:
https://wiki.openstack.org/wiki/Translations/Infrastructure

Change-Id: I9ec0512be11854e238eddda0399ae73cc2d60d4a
2016-04-16 06:46:25 +00:00
OpenStack Proposal Bot fa3a368d77 Updated from global requirements
Change-Id: I8486efae93766132cc0d9e12795422bd4befddf5
2016-04-07 17:13:19 +00:00
OpenStack Proposal Bot e0db3415d3 Updated from global requirements
Change-Id: Idf80333c78658a6708ba7069d25ae3424965e887
2016-02-26 01:52:30 +00:00
Brant Knudson ea1268bcd3 Deprecate load_json() in favor of load()
The Rules.load_json function now supports loading YAML and is not
limited to JSON. As such, the name is changed to load(). The old
name remains but is deprecated.

bp policy-yaml
Change-Id: I8c71d1a566779f1641106a996ebbc9551e2f05e3
2016-02-22 13:17:36 -06:00
Brant Knudson 83d209e9ed Support policy file in YAML
YAML provides the advantage of being able to add comments.

bp policy-yaml

Change-Id: Ic6236665f2d55b24a56a99120ac57fc2b18e32eb
2016-02-22 13:17:35 -06:00
OpenStack Proposal Bot 5fb13edfe6 Updated from global requirements
Change-Id: I40e90130045e9601028807fd3bc029ac7ad9a530
2016-02-20 21:59:38 +00:00
Andreas Jaeger b97a12c059 Update translation setup
Follow new infra setup for translations, see spec
http://specs.openstack.org/openstack-infra/infra-specs/specs/translation_setup.html
for full details.

This basically renames
oslo.policy/locale/oslo.policy.pot to
oslo_policy/locale/oslo_policy.pot. For this we need to update
setup.cfg.

Update also domain name in i18n.py.

The project has no translations currently, let's remove the outdated
pot file, the updated scripts work without them. So, we can just
delete the file and once there are translations, an updated pot file
together with translations can be imported automatically.

Change-Id: I9ca723834b1634a9ed965a92724d72fefc15e0d2
2016-01-29 11:47:44 +01:00