summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Updated from global requirementskilo-eolstable/kiloOpenStack Proposal Bot2015-07-133-8/+7
| | | | Change-Id: Iffc7cea49b9d759ab307108cd8f73b1cfbde0bc8
* Updated from global requirementsOpenStack Proposal Bot2015-04-152-5/+5
| | | | Change-Id: I4a909961c5eb5d0a7b212cd0650b5481a0c05e20
* Avoid reloading policy files in policy.d for every call0.3.2Davanum Srinivas2015-04-062-3/+79
| | | | | | | | | | | | | | | We added policy files in policy.d, currently, the code will reload the policy in policy.d every enforce been called. This patch caches the file mtime of the most newest file in the directory (or the directory itself if it is empty) and uses that to detect if we need to reload files in the policy.d directory. Change-Id: I3ab1ce1f2132ea8672bf0765ee4b30ad126d4559 Closes-Bug: 1437992 Co-Authored-By: Eli Qiao <liyong.qiao@intel.com> Cherry-pick: Ia8c273c8566a4b472cb8807b1576ef1dee8ef054
* set defaultbranch for reviewsDoug Hellmann2015-04-061-0/+1
| | | | Change-Id: I71ca555c621e06ceb136d8b9cefdf6290023ec87
* Switch to non-namespaced module imports0.3.1Davanum Srinivas2015-03-121-1/+1
| | | | Change-Id: If88e06eb52934d7cbf10a84f47776b2e89b568c1
* Merge "deprecate policy_dirs option"0.3.0Jenkins2015-03-051-1/+3
|\
| * deprecate policy_dirs optionSteve Martinelli2015-03-051-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is not clear why this is a configurable option. The original blueprint just wanted the ability to specify a policy.d infrastructure to make complex policies easier to enforce. There was no requirement on it being configurable. Being configurable just exposes another way in which incompatibilities in OpenStack projects might be able to emerge. As this merged late in the incubator lifecycle for the policy code, there are likely few/no existing users of the option so it should be safe to deprecate it for the library. That way we won't break anyone currently using it, and don't have to commit to supporting it going forward. Co-Authored-By: Steve Martinelli <stevemar@ca.ibm.com> Change-Id: I40bcbfbd4ab626fa9bfa050792e9ed3cfb587225
* | Updated from global requirementsOpenStack Proposal Bot2015-03-051-1/+1
|/ | | | Change-Id: I0a7d0e7e5f9a6ee9952ebeb30f27fb29c029f7b8
* Merge "Expose register and Check as part of public API"Jenkins2015-03-032-0/+16
|\
| * Expose register and Check as part of public APIIhar Hrachyshka2015-03-032-0/+16
| | | | | | | | | | | | | | | | Those symbols are used by Neutron for legitimate cases (defining a custom check). Change-Id: I96e9838068194b7b0903a738a94eb8f1b01ecdbe Closes-Bug: #1426005
* | provide more descriptive exceptionSean Dague2015-03-031-3/+4
| | | | | | | | | | | | | | | | | | When policy disallows an action, the existing exception doesn't contain anything except the rule. That means finding out why becomes somewhat difficult. We should provide the matrix of information that was used in the decision in the exception. Change-Id: I99c46fcc9f16f2b13a1b5527a3754da26dacf248
* | Add missing space to help message0.2.0Ben Nemec2015-02-261-1/+1
|/ | | | Change-Id: I1c14ac1b423d1408e8dde06af79163baa6d38877
* Merge "Add Rules.from_dict classmethod"Jenkins2015-02-202-0/+17
|\
| * Add Rules.from_dict classmethodIan Cordasco2015-02-192-0/+17
| | | | | | | | | | | | | | | | | | | | Many services currently construct a Rules instance from a dictionary in their tests. It would be beneficial to them if they didn't have to import oslo_policy._parser in order to parse a rule before passing it to Rules.__init__. Adding a Rules.from_dict classmethod should satisfy the need to create a Rules instance from a dictionary in tests. Change-Id: I3d73059277c45d4852f842474c6f1d61daa349b8
* | Use assertTrue or assertFalse where appropriateIan Cordasco2015-02-192-72/+40
| | | | | | | | | | | | | | | | | | Previously we were using assertEqual(True, expected) or assertEqual(False, exepected) instead of assertTrue or assertFalse respectively. This simply updates the existing tests to follow the common practice in oslo and OpenStack. Change-Id: I05747a13533be00f7adc827276b833ae6aefd725
* | Fix the order of args to assertEqual in testsIan Cordasco2015-02-193-147/+158
|/ | | | | | | | | The order of parameters needs to be (expected, actual) and many of the tests in test_checks, test_parser, and test_policy were not following that convention. Closes-bug: 1277104 Change-Id: I2259972de4961bf9d5f9c6742d81eb083b770fba
* Clean up configuration option management0.1.0Doug Hellmann2015-02-184-27/+100
| | | | | | | | | | | | | | Move the option definitions into the opts module with the other functions related to options. Add set_defaults() to override the default settings for options and make it part of the public API of the library by including it in the documentation. Add opts._register() so the options can be registered consistently from multiple places. Change-Id: Ib74beac58a07bf5ee0f92c2b7eda8281ef7d7c33
* Update comments about tox configurationDoug Hellmann2015-02-171-4/+4
| | | | | | | Explain the real reason for not using skipdist and develop in this library, which does not have the namespace package. Change-Id: Iaa91ab87ccacae8c26efc473e17b378eec50c31a
* Fix i18n importsDoug Hellmann2015-02-172-5/+2
| | | | | | | | Import the symbols needed from _i18n directly, relying on the import exception to avoid pep8 errors. Remove the imports that aren't being used. Change-Id: I8baef5ab859f005ff515b97adb9952f2ef1003e1
* Change default set of tox environmentsDoug Hellmann2015-02-171-1/+1
| | | | | | | | | Remove py33, since we don't test on 3.3 any more. Remove pypy, since we don't need to test that locally by default (it may still be tested in the gate). Change-Id: If714935c975de73000b5b94f9fdb1f62c3e05c55
* Create the temporary files needed for testsDoug Hellmann2015-02-179-54/+111
| | | | | | | | | | | | | | | | | Rather than keeping test input files in git, create them on the fly as needed. This allows us to streamline one or two tests that modify the files and then try to restore their old contents, and it also ensures that looking at a given test it is clear which files are really being used. This change also updates the implementation of some tests that were counting log calls to see how many files were loaded by making the Enforcer track the files it loads so we can look at the list explicitly. This gives us verification that the files we care about are the ones being loaded, and is less brittle in case we change the logging structure within the policy module. Change-Id: I109b3d5afc622df7e5e7a12d06c4fb1baad18b1a
* Fix minor spelling issues in oslo.policySteve Martinelli2015-02-172-2/+2
| | | | Change-Id: I351ab4f335d3bbb642e9e9bc225dd8725559989b
* Use single quotes consistentlySteve Martinelli2015-02-177-60/+67
| | | | | | | | Throughout the project both single and double quotes are used, let's just stick to one consistent format. Also removed a few contractions in messages Change-Id: I6636830bef53fadbab8616abdce9b731d39a1d10
* Merge "Do not log on missing or empty policy_dirs"Jenkins2015-02-162-6/+19
|\
| * Do not log on missing or empty policy_dirsIan Wienand2015-02-162-6/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "missing directory" message for the default policy-directory is being hit constantly and requiring work-arounds (e.g. I335a661d307a330e8b59883ef60c787c6590eb42) It was turned down from a warning in I183597f23b3a5eb44debd73f7a4a4444ca0d22fd. As it says there, the directory missing is considered a normal condition. Previous revisions of this change have modified this log to only fire if policy_dirs is set to something other than the default and to deprecate the default value of policy_dirs so the directory is not searched. The policy_dirs option as written (and exposed, hence limiting change) is analogous to a PATH setting; we attempt to search each entry but a missing or empty directory does not indicate a problem. In a theoretical sense this actually seems quite sound; some setup might have some specific host policy files in /etc/policy.d and global ones in /usr/share/policy.d; the non-existence of /etc/policy.d would not be an error but just mean that on this host only the /usr/share/policy.d ones are wanted. However, the existing debug level message about a file being should be expanded to show the actual file that was loaded. This allows investigators insight into what policies have actually been loaded and from where. Debugging test-cases are updated to verify that we get debug-level messages about the loaded files. Additionally, the documentation for policy_dirs is expanded to make it clear the directories may be missing or empty. Related-Bug: #1421863 Change-Id: Ib749b2a019c89bec811d3da5a369ffcdd27bc76f
* | Remove symlinked file from testsSteve Martinelli2015-02-121-1/+0
| | | | | | | | | | | | | | | | | | | | After https://review.openstack.org/#/c/154615/ merged, when attempting to pull down oslo.policy the following error came up: error: can't copy 'oslo_policy/tests/var/policy.d/fake_link': doesn't exist or not a regular file Change-Id: I306c99530bacb7944979e2e47ed057b85cde9898
* | Merge "document the migration process and update the docs a bit"Jenkins2015-02-113-5/+39
|\ \
| * | document the migration process and update the docs a bitSteve Martinelli2015-02-113-5/+39
| |/ | | | | | | | | | | | | | | | | | | stylize the docs, and document the migration process, specifically calling out the changes to the Enforcer class, which now required an oslo.config config object to be passed in. implements bp graduate-policy Change-Id: Ief4395f3312b90adea1f05903b9498b730663a74
* | Use standard logging in oslo.policySteve Martinelli2015-02-103-3/+3
|/ | | | | | | | | Oslo libraries should not depend on oslo.log, we should use standard logging, as noted in the graduation guidelines. partially implements bp graduate-policy Change-Id: I9d3973ad4b5b32922fa56881b679ad9e403289ea
* Updated from global requirementsOpenStack Proposal Bot2015-02-091-3/+3
| | | | Change-Id: Iafb2554d37db033914193aaf32ae4d7b2072577a
* Merge "Upgrade hacking to >=0.10.0"Jenkins2015-02-093-3/+5
|\
| * Upgrade hacking to >=0.10.0Steve Martinelli2015-02-063-3/+5
| | | | | | | | | | | | | | The current version of hacking is very old; upgrade hacking and fix any minor errors that were uncovered. Change-Id: Iabf38881b6030dce903c8e74670bfd6e5eabbc20
* | Merge "Remove globals that were introduced for compatibility"Jenkins2015-02-093-8/+5
|\ \ | |/ |/|
| * Remove globals that were introduced for compatibilitySteve Martinelli2015-02-063-8/+5
| | | | | | | | | | | | | | | | Looks like only Rules and Enforcer are ever consumed, so there is no need to have globals for backwards compatibility for Check/BaseCheck/register. Change-Id: Ifc482beb2bb9d9dd25102730d6d21792f23be3af
* | Remove oslo.concurrency from requirementsSteve Martinelli2015-02-062-7/+2
|/ | | | | | | | | This was only being used in a test, which has since been refactored to not need lockutils, as such we can remove oslo.concurrency from this requirements list. Also remove a reference of it from tox.ini Change-Id: I3da48a5a99db126637d78a5eadfa44da594b82c2
* Stop shouting test attribute namesDoug Hellmann2015-02-062-11/+8
| | | | | | | Change the instance attribute name CONF to conf because it's not a global. Change-Id: Ibfe19e0159b40952dbe28fb47b6940a13000dffc
* Do not use global enforcer for testsDoug Hellmann2015-02-062-24/+13
| | | | | | | Have each test instantiate its own enforcer object with a private configuration. Change-Id: I5eb354f0149be4bd4ec3eeb46ce9274b04781c9a
* Make use of private modulesIan Cordasco2015-02-067-1411/+1534
| | | | | | | | | | | | Move the parser and checks logic into oslo_policy._parser and oslo_policy._checks respectively. As a consequence, this allows us to create separate test files for those modules so we now also have oslo_policy.tests.test_parser and oslo_policy.tests.test_checks. Since those modules needed some common classes and fixtures it was also necessary to add oslo_policy.tests.base to service the three test modules. Change-Id: I656dcb8fda7b953f5def8ddfaa4d119a8c881965
* Privatize parsing classesSteve Martinelli2015-02-052-46/+46
| | | | | | | | A first hack at attempting to privatize certain classes and functions. Change-Id: I520767731e510ca2edf46511a54687a5a45919df Closes-Bug: #1415633
* Add entry points for option discoverySteve Martinelli2015-02-054-19/+64
| | | | | | | | Create entry points for oslo.policy, and make the necessary changes to grouping the options into a new 'oslo_policy' group. Change-Id: I32fd78c8a90fd2d49824db145362069b81fcaec5 Closes-Bug: #1415631
* Merge "Add pep8 import exception for oslo_policy._i18n"Jenkins2015-02-051-1/+1
|\
| * Add pep8 import exception for oslo_policy._i18nDoug Hellmann2015-02-051-1/+1
| | | | | | | | Change-Id: Ifd692642e5994f80edbc9d02041105176e756fa6
* | Merge "Use oslo_i18n"Jenkins2015-02-054-46/+37
|\ \ | |/
| * Use oslo_i18nSteve Martinelli2015-02-054-46/+37
| | | | | | | | | | | | | | Remove the copied over version from oslo-incubator and use the library oslo.i18n Change-Id: I0511c63b9c65c6585cc999c4fae0fd0b21b19d48
* | Merge "Perform an oslo-sync"Jenkins2015-02-054-139/+5
|\ \ | |/
| * Perform an oslo-syncSteve Martinelli2015-02-054-139/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | Removed run_cross_tests from openstack-common.conf Removed all of oslo_policy/openstack/common Performed sync from latest master of oslo-incubator Undid the delete to oslo_policy/openstack/common/_i18n.py since it is still required, until we move to oslo.i18n. oslo-incubator was at commit level: 9a1970b3708114cc52f89a7b4d048eeae9140fef Change-Id: I55288e618b268b73012784481c00285195edbf3b
* | Merge "Drop use of oslo namespace for oslo libraries"Jenkins2015-02-051-3/+3
|\ \ | |/ |/|
| * Drop use of oslo namespace for oslo librariesSteve Martinelli2015-02-041-3/+3
| | | | | | | | | | | | | | | | For example, instead of oslo.config, we should use oslo_config. Related-blueprint: drop-namespace-packages Change-Id: Iee1bc653196ba699fae0fb844638bd745286ee85
* | Merge "General docstring cleanup"Jenkins2015-02-051-89/+115
|\ \
| * | General docstring cleanupBrant Knudson2015-02-041-89/+115
| | | | | | | | | | | | | | | | | | The docstrings weren't pretty. Change-Id: I76d17ee3f6dfca8e79b25b9d5ec81ec5194b571c