summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Laski <andrew@lascii.com>2016-06-21 16:53:57 -0400
committerAndrew Laski <andrew@lascii.com>2016-06-28 20:52:44 +0000
commit5e38fa3cb5ae850dcf2bb251b4098220424a6ed6 (patch)
treef5bcd6bc4e7ecf3df0157a7bc30706586e4915b2
parent41616f9d550ba86ee0a2ff0a57efc0bd9c0bdb2a (diff)
downloadnova-5e38fa3cb5ae850dcf2bb251b4098220424a6ed6.tar.gz
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. The command is also run in the docs tox target since the sample file can be considered documentation. Change-Id: I18a1fa567fc04b0e0a37c02f20024b2ce483f060 Partially-Implements: bp policy-in-code
-rw-r--r--.gitignore1
-rw-r--r--etc/nova/nova-policy-generator.conf3
-rw-r--r--setup.cfg7
-rw-r--r--tox.ini4
4 files changed, 15 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 900f8703ce..a90a414002 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,6 +33,7 @@ doc/build/*
api-guide/build/*
api-ref/build/*
etc/nova/nova.conf.sample
+etc/nova/policy.yaml.sample
instances
keeper
keys
diff --git a/etc/nova/nova-policy-generator.conf b/etc/nova/nova-policy-generator.conf
new file mode 100644
index 0000000000..0f02a950af
--- /dev/null
+++ b/etc/nova/nova-policy-generator.conf
@@ -0,0 +1,3 @@
+[DEFAULT]
+output_file = etc/nova/policy.yaml.sample
+namespace = nova
diff --git a/setup.cfg b/setup.cfg
index 1775e9c2d4..49c7479f2b 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -36,6 +36,13 @@ oslo.config.opts =
oslo.config.opts.defaults =
nova.api = nova.common.config:set_middleware_defaults
+oslo.policy.policies =
+ # The sample policies will be ordered by entry point and then by list
+ # returned from that entry point. If more control is desired split out each
+ # list_rules method into a separate entry point rather than using the
+ # aggregate method.
+ nova = nova.policies:list_rules
+
nova.compute.monitors.cpu =
virt_driver = nova.compute.monitors.cpu.virt_driver:Monitor
nova.compute.resources =
diff --git a/tox.ini b/tox.ini
index fdc78bdeea..5904a63beb 100644
--- a/tox.ini
+++ b/tox.ini
@@ -60,6 +60,9 @@ commands =
[testenv:genconfig]
commands = oslo-config-generator --config-file=etc/nova/nova-config-generator.conf
+[testenv:genpolicy]
+commands = oslopolicy-sample-generator --config-file=etc/nova/nova-policy-generator.conf
+
[testenv:cover]
# Also do not run test_coverage_ext tests while gathering coverage as those
# tests conflict with coverage.
@@ -87,6 +90,7 @@ commands =
python setup.py build_sphinx
bash -c '! find doc/ -type f -name *.json | xargs -t -n1 python -m json.tool 2>&1 > /dev/null | grep -B1 -v ^python'
oslo-config-generator --config-file=etc/nova/nova-config-generator.conf
+ oslopolicy-sample-generator --config-file=etc/nova/nova-policy-generator.conf
sphinx-build -W -b html api-guide/source api-guide/build/html
sphinx-build -W -b html api-ref/source api-ref/build/html