Skip to content

Commit c9de2d6

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Handle 403 error on creating trust"
2 parents 30ddab2 + 5cf77bb commit c9de2d6

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

openstackclient/identity/v3/trust.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import datetime
1717
import logging
1818

19+
from keystoneclient import exceptions as identity_exc
1920
from osc_lib.command import command
2021
from osc_lib import exceptions
2122
from osc_lib import utils
@@ -105,10 +106,13 @@ def take_action(self, parsed_args):
105106

106107
role_names = []
107108
for role in parsed_args.role:
108-
role_name = utils.find_resource(
109-
identity_client.roles,
110-
role,
111-
).name
109+
try:
110+
role_name = utils.find_resource(
111+
identity_client.roles,
112+
role,
113+
).name
114+
except identity_exc.Forbidden:
115+
role_name = role
112116
role_names.append(role_name)
113117

114118
expires_at = None
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
fixes:
3+
- |
4+
Correctly handle non-admin in ``create trust`` command when looking
5+
up role names.
6+
[Bug `1658582 <https://bugs.launchpad.net/python-openstackclient/+bug/1658582>`_]

0 commit comments

Comments
 (0)