deb-murano/tox.ini
Felipe Monteiro b360bf7ab7 Add policy sample generation
This adds the entry point and config file necessary for using the
oslo.policy sample generation script. It also adds a tox target to
simplify the usage of it. Finally, this commit adds
murano.common.policies.base.list_rules to
murano.common.polices (__init__.py) so that the base rules are
also included in the generated policy file.

Note that the policy sample is generated as a YAML which is
the standard adopted by Nova [0] and Keystone [1] and is now
the standard across OpenStack since Ocata [2]:

    While the old json format policy file is still supported,
    we recommend using the newer YAML format file, more intuitive
    syntax.

The output from tox -egenpolicy will be:

    murano.policy.sample.yaml in murano/etc.

The policy documentation was already updated in
I1a8581a559e4333a74d56a5bdce7e6d1f117907d

[0] e845d66a1b/etc/nova/nova-policy-generator.conf
[1] https://github.com/openstack/keystone/blob/master/config-generator/keystone-policy-generator.conf
[2] https://docs.openstack.org/ocata/config-reference/policy-yaml-file.html#older-json-format-policy

Change-Id: I2356ac0b2033bd83caaf2672189670fc300e55fd
Partially-Implements: blueprint policy-in-code
2017-06-17 16:11:17 +01:00

94 lines
2.7 KiB
INI

[tox]
envlist = py35,py27,pep8
minversion = 1.8
skipsdist = True
[testenv]
usedevelop = True
install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
setenv =
VIRTUAL_ENV={envdir}
DISCOVER_DIRECTORY=murano/tests/unit
passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands = rm -f .testrepository/times.dbm
bash tools/pretty_tox.sh '{posargs}'
whitelist_externals = bash
find
rm
[testenv:py27-ocata]
install_command = pip install -chttps://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/ocata {opts} {packages}
[testenv:murano-test-runner]
commands = murano-test-runner {posargs}
[testenv:pep8]
commands =
flake8 {posargs}
{[testenv:bandit]commands}
[testenv:bandit]
commands = bandit -c bandit.yaml -r murano -x tests -n 5 -ll
[testenv:venv]
commands = {posargs}
[testenv:cover]
commands = {toxinidir}/tools/cover.sh {posargs}
[testenv:debug]
commands =
find . -type f -name "*.pyc" -delete
oslo_debug_helper {posargs}
[testenv:docs]
commands = python setup.py build_sphinx
[testenv:murano-firstapp]
commands = sphinx-build -E -W -d doc/build/murano-firstapp/doctrees -b html doc/source/first-app/source doc/build/murano-firstapp/html
[testenv:pyflakes]
deps = flake8
commands = flake8
[testenv:pylint]
setenv = VIRTUAL_ENV={envdir}
commands = bash tools/lintstack.sh
[testenv:genconfig]
commands =
oslo-config-generator --config-file etc/oslo-config-generator/murano.conf
[testenv:gencfconfig]
commands =
oslo-config-generator --config-file etc/oslo-config-generator/murano-cfapi.conf
[testenv:genpolicy]
commands = oslopolicy-sample-generator --config-file etc/oslo-policy-generator/murano-policy-generator.conf
[testenv:releasenotes]
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
[testenv:install-guide]
commands = sphinx-build -a -E -W -d install-guide/build/doctrees -b html install-guide/source install-guide/build/html
[testenv:api-ref]
# This environment is called from CI scripts to test and publish
# the API Ref to developer.openstack.org.
commands =
rm -rf api-ref/build
sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html
whitelist_externals = rm
[flake8]
show-source = true
builtins = _
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
[hacking]
local-check-factory = murano.hacking.checks.factory
import_exceptions = oslo.db.sqlalchemy.test_base,
murano.common.i18n