diff --git a/openstackclient/identity/v3/trust.py b/openstackclient/identity/v3/trust.py index 04ee4dce5a..52daeb4d16 100644 --- a/openstackclient/identity/v3/trust.py +++ b/openstackclient/identity/v3/trust.py @@ -16,6 +16,7 @@ import datetime import logging +from keystoneclient import exceptions as identity_exc from osc_lib.command import command from osc_lib import exceptions from osc_lib import utils @@ -105,10 +106,13 @@ class CreateTrust(command.ShowOne): role_names = [] for role in parsed_args.role: - role_name = utils.find_resource( - identity_client.roles, - role, - ).name + try: + role_name = utils.find_resource( + identity_client.roles, + role, + ).name + except identity_exc.Forbidden: + role_name = role role_names.append(role_name) expires_at = None diff --git a/releasenotes/notes/bug-1658582-80a76f6b0af0ca12.yaml b/releasenotes/notes/bug-1658582-80a76f6b0af0ca12.yaml new file mode 100644 index 0000000000..ee8b25c5c8 --- /dev/null +++ b/releasenotes/notes/bug-1658582-80a76f6b0af0ca12.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Correctly handle non-admin in ``create trust`` command when looking + up role names. + [Bug `1658582 `_]