diff options
| author | Navid Pustchi <npustchi@gmail.com> | 2016-02-04 16:45:38 +0000 |
|---|---|---|
| committer | Alvaro Lopez Garcia <aloga@ifca.unican.es> | 2016-06-09 18:00:40 +0200 |
| commit | 6ae0d2e8a54fd5139e63a990ab4bdce634e73c5e (patch) | |
| tree | 5833e88147e71524b49a5b25979fd17869dd455c /openstackclient/identity/v2_0/role.py | |
| parent | ada6abb30e6b1c49229817ae53ab96d88c50fd21 (diff) | |
| download | python-openstackclient-6ae0d2e8a54fd5139e63a990ab4bdce634e73c5e.tar.gz | |
Moving authentication from keystoneclient to keystoneauth
Currently OpenStackClient uses keystoneclient for authentication.
This change will update OpenStackClient to use keystoneauth for
authentication.
All dependant test have been updated.
Updating how auth_ref is set in the tests to use KSA fixtures had
some racy side-effects. The user_role_list tests failed when they
picked up an auth_ref that was a fixture. This exposed a weakness
in ListUserRole that needed to be fixed at the same time re
handling of unscoped tokens and options.
Change-Id: I4ddb2dbbb3bf2ab37494468eaf65cef9213a6e00
Closes-Bug: 1533369
Diffstat (limited to 'openstackclient/identity/v2_0/role.py')
| -rw-r--r-- | openstackclient/identity/v2_0/role.py | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/openstackclient/identity/v2_0/role.py b/openstackclient/identity/v2_0/role.py index 6b014d86..0f8da992 100644 --- a/openstackclient/identity/v2_0/role.py +++ b/openstackclient/identity/v2_0/role.py @@ -231,18 +231,19 @@ class ListUserRole(command.Lister): # Project and user are required, if not included in command args # default to the values used for authentication. For token-flow # authentication they must be included on the command line. + if (not parsed_args.project and + self.app.client_manager.auth_ref.project_id): + parsed_args.project = auth_ref.project_id if not parsed_args.project: - if self.app.client_manager.auth_ref: - parsed_args.project = auth_ref.project_id - else: - msg = _("Project must be specified") - raise exceptions.CommandError(msg) + msg = _("Project must be specified") + raise exceptions.CommandError(msg) + + if (not parsed_args.user and + self.app.client_manager.auth_ref.user_id): + parsed_args.user = auth_ref.user_id if not parsed_args.user: - if self.app.client_manager.auth_ref: - parsed_args.user = auth_ref.user_id - else: - msg = _("User must be specified") - raise exceptions.CommandError(msg) + msg = _("User must be specified") + raise exceptions.CommandError(msg) project = utils.find_resource( identity_client.tenants, |
