Skip to content

Commit def0a91

Browse files
committed
Log error if we cannot retrieve users
Fixes #89
1 parent 4f192e0 commit def0a91

File tree

4 files changed

+38
-74
lines changed

4 files changed

+38
-74
lines changed

caso/extract/nova.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import dateutil.parser
2222
import glanceclient.client
23+
import keystoneauth1.exceptions.http
2324
import neutronclient.v2_0.client
2425
import novaclient.client
2526
import novaclient.exceptions
@@ -115,7 +116,13 @@ def _get_keystone_user(self, uuid):
115116
try:
116117
user = self.keystone.users.get(user=uuid)
117118
return user.name
118-
except Exception:
119+
except keystoneauth1.exceptions.http.Forbidden as e:
120+
LOG.error("Unauthorized to get user")
121+
LOG.exception(e)
122+
return None
123+
except Exception as e:
124+
LOG.debug("Exception while getting user")
125+
LOG.exception(e)
119126
return None
120127

121128
def build_record(self, server):

doc/source/configuration.rst

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -44,26 +44,27 @@ Policy modifications
4444
The accounting user needs access to Keystone so as to extract the users
4545
information. In this case, we can can grant the user just the rights for
4646
listing the users adding the appropriate rules in your policy configuration.
47+
Depending on your configuration, you need to modify the JSON policy file
48+
(``/etc/keystone/policy.json``) or the YAML policy file (``/etc/keystone/policy-yaml``).
4749
The modifications in the policy depend on the Keystone version, please ensure
48-
that you are applying the correct changes.
49-
50-
Keystone Versions from Ussuri onwards (version >= 17.0.0)
51-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
52-
53-
You need to modify the ``identity:list_users`` policy in either your
54-
``/etc/keystone/policy.json`` or ``/etc/keystone/policy-yaml``, contaning the
55-
following policy rules::
56-
57-
"identity:list_users": "(role:admin) or (role:reader and domain_id:%(target.domain_id)s) or (role:accounting)"
58-
59-
Keystone Versions from until Train (version < 17.0.0)
60-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
61-
62-
You need to modify the ``identity:list_users`` policy in either your
63-
``/etc/keystone/policy.json`` or ``/etc/keystone/policy-yaml``, contaning the
64-
following policy rules::
65-
66-
"identity:list_users": "rule:admin_required or role:accounting"
50+
that you are applying the correct changes as listed in the following table.
51+
52+
+-------------+------------------------------------------------------------------------------+
53+
| OpenStack | Policy contents |
54+
| Version | |
55+
+=============+==========+===================================================================+
56+
| From Stein | Original | ``“identity:get_user”: “(role:reader and system_scope:all) or |
57+
| (>= 15.0.0) | | (role:reader and token.domain.id:%(target.user.domain_id)s) or |
58+
| | | user_id:%(target.user.id)s”`` |
59+
| +----------+-------------------------------------------------------------------+
60+
| | Modified | ``“identity:get_user”: “(role:reader and system_scope:all) or |
61+
| | | (role:reader and token.domain.id:%(target.user.domain_id)s) or |
62+
| | | user_id:%(target.user.id)s or role:accounting”`` |
63+
+-------------+----------+-------------------------------------------------------------------+
64+
| Up to Rocky | Original | ``“identity:get_user”: “rule:admin_or_owner”`` |
65+
| (<= 14.0.0) +----------+-------------------------------------------------------------------+
66+
| | Modified | ``“identity:get_user”: “rule:admin_or_owner or role:accounting”`` |
67+
+-------------+----------+-------------------------------------------------------------------+
6768

6869
Publishing benchmark information for OpenStack flavors (optional)
6970
-----------------------------------------------------------------
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
---
2+
fixes:
3+
- |
4+
Fix an issue when getting the usernames, that caused configuration errors
5+
to be unnoticed.
26
other:
37
- |
48
Keystone versions from Ussuri onwards (>= 17.0.0) implement a new policy.
59
Please check the documentation so as to ensure that you are applying the
610
correct changes.
11+
upgrade:
12+
- |
13+
Please ensure that you have the correct configuration in the policy files,
14+
as a new policy rule must be modified. The accounting user does not need to
15+
have access to the "identity:list_users" action, but to the "identity:get_user"
16+
action instead.

releasenotes/notes/reno.cache

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)