blob: 1e7fe8fb898026b8eb08fbe39cdf28a7322533b9 [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
Mykola Yakovlieve0f35502018-09-26 18:26:57 -050010RBAC Test Roles
11---------------
Felipe Monteiro8a5f69a2017-07-14 20:12:33 +010012
Mykola Yakovlieve0f35502018-09-26 18:26:57 -050013The RBAC test roles govern the list of roles to be used when running Patrole
14tests. For example, setting ``rbac_test_roles`` to "admin" will execute all
15RBAC tests using admin credentials. Changing the ``rbac_test_roles`` value
16will `override` Tempest's primary credentials to use that role.
Felipe Monteiro8a5f69a2017-07-14 20:12:33 +010017
Mykola Yakovlieve0f35502018-09-26 18:26:57 -050018This implies that, if ``rbac_test_roles`` is "admin", regardless of the Tempest
Felipe Monteiro8a5f69a2017-07-14 20:12:33 +010019credentials 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
Mykola Yakovlieve0f35502018-09-26 18:26:57 -050023Similarly, setting ``rbac_test_roles`` with various roles, results in
24Tempest's primary credentials being overridden by the roles specified by
25``rbac_test_roles``.
Felipe Monteiro8a5f69a2017-07-14 20:12:33 +010026
27.. note::
28
Mykola Yakovlieve0f35502018-09-26 18:26:57 -050029 Only the roles of the primary Tempest credentials ("os_primary") are
Felipe Monteiro8a5f69a2017-07-14 20:12:33 +010030 modified. The ``user_id`` and ``project_id`` remain unchanged.
31
Felipe Monteiro8a5f69a2017-07-14 20:12:33 +010032Custom Policy Files
33-------------------
34
35Patrole supports testing custom policy file definitions, along with default
36policy definitions. Default policy definitions are used if custom file
37definitions are not specified. If both are specified, the custom policy
38definition takes precedence (that is, replaces the default definition,
39as this is the default behavior in OpenStack).
40
41The ``custom_policy_files`` option allows a user to specify a comma-separated
42list of custom policy file locations that are on the same host as Patrole.
43Each policy file must include the name of the service that is being tested:
44for example, if "compute" tests are executed, then Patrole will use the first
45policy file contained in ``custom_policy_files`` that contains the "nova"
46keyword.
47
48.. note::
49
50 Patrole currently does not support policy files located on a host different
51 than the one on which it is running.
Felipe Monteiro9ae705d2018-03-26 22:14:44 -040052
53Policy Feature Flags
54--------------------
55
56Patrole's ``[policy-feature-enabled]`` configuration group includes one option
57per supported policy feature flag. These feature flags are introduced when an
58OpenStack service introduces a new policy or changes a policy in a
59backwards-incompatible way. Since Patrole is branchless, it copes with the
60unexpected policy change by making the relevant policy change as well, but
61also introduces a new policy feature flag so that the test won't break N-1/N-2
62releases where N is the currently supported release.
63
64The default value for the feature flag is enabled for N and disabled for any
65releases prior to N in which the feature is not available. This is done by
66overriding the default value of the feature flag in DevStack's ``lib/patrole``
67installation script. The change is made in Tempest's DevStack script because
68Patrole's DevStack plugin is hosted in-repo, which is branch-less (whereas
69the former is branched).
70
71After the backwards-incompatible change no longer affects any supported
72release, then the corresponding policy feature flag is removed.
73
74For more information on feature flags, reference the relevant
75`Tempest documentation`_.
76
zhufl788db672019-05-13 17:33:32 +080077.. _Tempest documentation: https://docs.openstack.org/tempest/latest/HACKING.html#new-tests-for-new-features
Felipe Monteiro9ae705d2018-03-26 22:14:44 -040078
79Sample Configuration File
80-------------------------
81
82The following is a sample Patrole configuration for adaptation and use. It is
83auto-generated from Patrole when this documentation is built, so
84if you are having issues with an option, please compare your version of
85Patrole with the version of this documentation.
86
87Note that the Patrole configuration options actually live inside the Tempest
88configuration file; at runtime, Tempest populates its own configuration
89file with Patrole groups and options, assuming that Patrole is correctly
90installed and recognized as a plugin.
91
92The sample configuration can also be viewed in `file form <_static/patrole.conf.sample>`_.
93
94.. literalinclude:: _static/patrole.conf.sample