Commit Graph

16 Commits

Author SHA1 Message Date
Ghanshyam Mann 1c87ebf9a8 [goal] Deprecate the JSON formatted policy file
As per the community goal of migrating the policy file
the format from JSON to YAML[1], we need to do two things:

1. Change the default value of '[oslo_policy] policy_file''
config option from 'policy.json' to 'policy.yaml' with
upgrade checks.

2. Deprecate the JSON formatted policy file on the project side
via warning in doc and releasenotes.

Also replace policy.json to policy.yaml ref from doc and tests.

CONF object needs to be initialized before policy enforcer(). That
need to remove cfg.CONF.unregister_opts from TestAuthUtils cleanup
as this is taken care by cfg.clear() with proper workflow otherwise
it end up with error
"oslo_config.cfg.ArgsAlreadyParsedError: arguments
already parsed: reset before unregistering options"

- https://b132754ee7062a9ab187-9add4719a9922a9385555a8552fc2366.ssl.cf5.rackcdn.com/768520/5/check/openstack-tox-py38/7964354/testr_results.html

[1]https://governance.openstack.org/tc/goals/selected/wallaby/migrate-policy-format-from-json-to-yaml.html

Change-Id: I1b6c6485bc651fd0b87244a68204036dd4aa37f4
2021-03-07 17:50:48 -06:00
zhurong 7eca01a7d6 Fix pep8 error
Change-Id: I2832b70a6eeb2b9edf2124977e4be362e0eedabe
2020-05-13 14:03:53 +08:00
Jeremy Liu 4661d8b147 Remove unused param
Change-Id: I11dcedf58a96da9b92f83f6dc3d51c3b0dc6a322
2017-09-03 22:27:54 +08:00
Felipe Monteiro fb1a2d5bbe Remove murano default policy.json
This commit removes the murano default policy.json file from
etc/murano and references to it in murano's devstack plugin.
(References to the policy.json in muranodashboard remain
the same).

This commit specifically:
  - removes the default policy.json
  - removes references to it in devstack plugin
  - adds base rules to murano.common.policies.__init__ because
    they are the last rules to be included
  - updates base admin_api rule to is_admin:True from
    is_admin:1 (because the latter was causing issues)
  - updates Murano policy documentation

Partially Implements: blueprint policy-in-code
Depends-On: Ia372983d2bd1010cd19f04061f3276ed16e9c1c9
Change-Id: I1a8581a559e4333a74d56a5bdce7e6d1f117907d
2017-06-16 03:07:49 +00:00
Felipe Monteiro 5b01f9464b Policy in code
This patch introduces the beginning implementation for registering
default policy rules in code. Default rules are defined under
murano.common.policies. Each API's policies are defined in a
sub-folder under that path and __init__.py contains all the
default policies in code which are registered in the ``init``
enforcer function in murano/common/policy.py.

The default rules for the environments API was removed from the
policy.json and moved into code under
murano.common.policies.environment. This can be gradually done
for the rest of the APIs in follow-up patches.

This commit does the following:
  - Creates the ``policies`` module that contains all the default
    policies in code.
  - Adds the base policy rules into code (the admin_api,
    context_is_admin, and default rules).
  - Adds the environment default policy module with default
    policy rules for the environments API.

Partially Implements: blueprint policy-in-code

Change-Id: Iebf2c60d1d31b73829fad189ada7ceee28e714bd
2017-05-31 15:20:18 +00:00
zhurong c4d1f7e687 Remove arguments "{}" and "[]" in function definitions
remove mutable default arguments "{}" and "[]" in function definitions
refer to:http://docs.python-guide.org/en/latest/writing/gotchas/

Change-Id: Ib03d9820a259b2cbd83aa8bd675ac6153cf78ebd
Closes-Bug: #1527080
2015-12-19 01:10:30 +08:00
Nikolay Starodubtsev 975bcc4a98 Log refactoring close to new logging spec
* correct log levels
* correct log messages

partial-bug: 1419872
partial-implements-bp: unified-style-logging

Change-Id: I80c2b4c809dc52125f9f4a3beec0cd3b6c4c1213
2015-09-09 20:54:26 +03:00
Nikolay Starodubtsev de5ed2115a Switch to oslo_log
To follow latest community practices we need to use oslo_log in
murano instead of handcrafted libs.
Unsupported log level 'audit' was changed to 'info'.

Change-Id: I40c0f3790e34bf80d0b63554e86b3cbc019eefca
2015-07-15 11:20:45 +03:00
Nikolay Starodubtsev d8579828a7 Organize imports in correct order
Organize imports in the way described in [1]

[1]: http://docs.openstack.org/developer/hacking/#imports

Change-Id: I53c1f7fa7271aaa953b72142f5cca8162aa06ff0
Partially-Bug: 1472597
2015-07-08 16:07:51 +03:00
Ekaterina Chernova 8d4f7c0aa8 Use oslo.policy instead of incubated version
Corresponding changes were made in murano common policy file
and in requirements.

Change-Id: Ic7c4f61db0bb2655c4c0041500bd74e8890ea038
Closes-Bug: #1458945
2015-06-04 11:51:30 +03:00
Doug Hellmann 21a14acba4 Drop use of 'oslo' namespace package
The Oslo libraries have moved all of their code out of the 'oslo'
namespace package into per-library packages. The namespace package was
retained during kilo for backwards compatibility, but will be removed by
the liberty-2 milestone. This change removes the use of the namespace
package, replacing it with the new package names.

The patches in the libraries will be put on hold until application
patches have landed, or L2, whichever comes first. At that point, new
versions of the libraries without namespace packages will be released as
a major version update.

Please merge this patch, or an equivalent, before L2 to avoid problems
with those library releases.

Blueprint: remove-namespace-packages
https://blueprints.launchpad.net/oslo-incubator/+spec/remove-namespace-packages

Change-Id: I975592f3694be42d52685ebf606f6d3012caf1a8
2015-04-28 20:21:22 +00:00
Ekaterina Chernova d82b74b62f Update API policy
* Set admin rule for a several API calls and remove direct check in code
* Now admin can configure policy.json and enable package management for regular users
* Update common policy module

Closes-Bug: #1412868

Change-Id: I8d0725b613564529d32a5acef289f4822f32915c
2015-03-02 15:28:14 +03:00
Kirill Zaitsev 4e036191ff Use oslo.i18n for translation
Remove gettextutils in favor of oslo.i18n suite for
internationalization purposes. Wrap murano.common.i18n around
oslo.i18n. Mark all logs messages of levels higher than
DEBUG for translation with _/_LI/_LW/_LE/_LC to conform with
oslo.i18n guidelines.

Change-Id: I09a2e2fc802e404f5c59fa4edd2a2124ad24101a
Implements: blueprint organize-translation
2015-02-19 18:51:22 +03:00
Ekaterina Chernova 87a63bf24e Resolve H305 pep8 issue
H305  imports not grouped correctly

Change-Id: Ia990dd628da195097838a13d876ef987363d3f8e
2015-02-05 12:10:22 +03:00
Steve McLellan 87e137e998 Fixes to unit tests around policies
* Change to policy check signature to default to an empty target
* Tests for policy checks were very inflexible. Changed now so that
  for each API test policy rules must be explicitly provided, and
  tests must record which, how many, and in what order policy checks
  should be expected
* Test requests look more like actual requests; rather than calling the
  controller functions directly, tests go through the WSGI mapper/router
  infrastructure and all input/output must be valid as far as the wsgi
  is concerned.

Change-Id: I1dbf35249b4efd6ae9c85b08139e3a627fff6fc5
2014-07-31 19:20:57 +04:00
Steve McLellan 185dd9305a Add policy checks to API
Adds ability for deploy-time auth checks to allow/disallow
functionality, in line with other openstack projects.

Includes update of code in openstack/common, which is why the
patchset is so large. oslo-incubator changeset is May 27th
caed79d8239679cb74476bb0d9e5011b4fcc39da.

Implements blueprint policy-checks-in-api

Change-Id: I67a431dcc74f0a77ed48b7a489136d5008773cea
2014-06-11 13:37:41 -05:00