blob: f6aaf04a5d08444784aeb3fa4bb7e10a08188439 [file] [log] [blame]
Felipe Monteiro8a5f69a2017-07-14 20:12:33 +01001.. _patrole-configuration:
2
3Patrole Configuration Guide
4===========================
5
6Patrole can be customized by updating Tempest's ``tempest.conf`` configuration
7file. All Patrole-specific configuration options should be included under
Felipe Monteirof6eb8622017-08-06 06:08:02 +01008the ``patrole`` group.
Felipe Monteiro8a5f69a2017-07-14 20:12:33 +01009
10RBAC Test Role
11--------------
12
13The RBAC test role governs which role is used when running Patrole tests. For
14example, setting ``rbac_test_role`` to "admin" will execute all RBAC tests
15using admin credentials. Changing the ``rbac_test_role`` value will `override`
16Tempest's primary credentials to use that role.
17
18This implies that, if ``rbac_test_role`` is "admin", regardless of the Tempest
19credentials used by a client, the client will be calling APIs using the admin
20role. That is, ``self.os_primary.servers_client`` will run as though it were
21``self.os_admin.servers_client``.
22
23Similarly, setting ``rbac_test_role`` to a non-admin role results in Tempest's
melissaml7cd21612018-05-23 21:00:50 +080024primary credentials being overridden by the role specified by
Felipe Monteiro8a5f69a2017-07-14 20:12:33 +010025``rbac_test_role``.
26
27.. note::
28
29 Only the role of the primary Tempest credentials ("os_primary") is
30 modified. The ``user_id`` and ``project_id`` remain unchanged.
31
32Enable RBAC
33-----------
34
35Given the value of ``enable_rbac``, enables or disables Patrole tests. If
36``enable_rbac`` is ``False``, then Patrole tests are skipped.
37
Felipe Monteiro8a5f69a2017-07-14 20:12:33 +010038Custom Policy Files
39-------------------
40
41Patrole supports testing custom policy file definitions, along with default
42policy definitions. Default policy definitions are used if custom file
43definitions are not specified. If both are specified, the custom policy
44definition takes precedence (that is, replaces the default definition,
45as this is the default behavior in OpenStack).
46
47The ``custom_policy_files`` option allows a user to specify a comma-separated
48list of custom policy file locations that are on the same host as Patrole.
49Each policy file must include the name of the service that is being tested:
50for example, if "compute" tests are executed, then Patrole will use the first
51policy file contained in ``custom_policy_files`` that contains the "nova"
52keyword.
53
54.. note::
55
56 Patrole currently does not support policy files located on a host different
57 than the one on which it is running.
Felipe Monteiro9ae705d2018-03-26 22:14:44 -040058
59Policy Feature Flags
60--------------------
61
62Patrole's ``[policy-feature-enabled]`` configuration group includes one option
63per supported policy feature flag. These feature flags are introduced when an
64OpenStack service introduces a new policy or changes a policy in a
65backwards-incompatible way. Since Patrole is branchless, it copes with the
66unexpected policy change by making the relevant policy change as well, but
67also introduces a new policy feature flag so that the test won't break N-1/N-2
68releases where N is the currently supported release.
69
70The default value for the feature flag is enabled for N and disabled for any
71releases prior to N in which the feature is not available. This is done by
72overriding the default value of the feature flag in DevStack's ``lib/patrole``
73installation script. The change is made in Tempest's DevStack script because
74Patrole's DevStack plugin is hosted in-repo, which is branch-less (whereas
75the former is branched).
76
77After the backwards-incompatible change no longer affects any supported
78release, then the corresponding policy feature flag is removed.
79
80For more information on feature flags, reference the relevant
81`Tempest documentation`_.
82
83.. _Tempest documentation: https://docs.openstack.org/tempest/latest/HACKING.html#1-new-tests-for-new-features
84
85Sample Configuration File
86-------------------------
87
88The following is a sample Patrole configuration for adaptation and use. It is
89auto-generated from Patrole when this documentation is built, so
90if you are having issues with an option, please compare your version of
91Patrole with the version of this documentation.
92
93Note that the Patrole configuration options actually live inside the Tempest
94configuration file; at runtime, Tempest populates its own configuration
95file with Patrole groups and options, assuming that Patrole is correctly
96installed and recognized as a plugin.
97
98The sample configuration can also be viewed in `file form <_static/patrole.conf.sample>`_.
99
100.. literalinclude:: _static/patrole.conf.sample