Ask Your Question
2

What is the equivalent command for user-role-list in openstack client for V3 api ?

asked 2015-01-06 05:09:38 -0500

deeghuge gravatar image

Hello, How to list the role of particular user in specific project with openstack client? With old keystone client user-role-list used to do this but there is no similar command in openstack client ? Thanks

edit retag flag offensive close merge delete

4 answers

Sort by » oldest newest most voted
3

answered 2015-01-06 11:16:20 -0500

updated 2015-01-08 11:12:01 -0500

Try

openstack role list --user <user_id> --project <--project_id>

There is nothing called user-role-list, it is always user-role-list for a project in keystoneclient

Update 1:

You need to export environment variable to list v3 apis available

export OS_IDENTITY_API_VERSION=3

/opt/stack$ export OS_IDENTITY_API_VERSION=3
/opt/stack$ openstack help role list 
usage: openstack role list [-h] [-f {csv,html,json,table,yaml}] [-c COLUMN]
                           [--max-width <integer>]
                           [--quote {all,minimal,none,nonnumeric}]
                           [--domain <domain> | --project <project>]
                           [--user <user> | --group <group>]
List roles

optional arguments:
  -h, --help            show this help message and exit
  --domain <domain>     Filter roles by <domain> (name or ID)
  --project <project>   Filter roles by <project> (name or ID)
  --user <user>         Filter roles by <user> (name or ID)
  --group <group>       Filter roles by <group> (name or ID)

edit flag offensive delete link more

Comments

There is no option --user or --project in the openstack role list command.

deeghuge gravatar imagedeeghuge ( 2015-01-08 00:38:34 -0500 )edit

Openstack client is by default v2.0 and it will only list v2 apis. You need to switch the mode to use V3. Try after exporting this environment variable

export OS_IDENTITY_API_VERSION=3

Haneef Ali gravatar imageHaneef Ali ( 2015-01-08 11:07:52 -0500 )edit
1

answered 2017-07-24 03:14:14 -0500

Erico gravatar image

openstack role assignment list --names

edit flag offensive delete link more

Comments

Good answer. The warning doesn't specify the 'openstack' prefix for the role assignment list.

zetret gravatar imagezetret ( 2017-07-28 15:03:09 -0500 )edit
0

answered 2017-07-28 08:03:15 -0500

updated 2017-07-28 08:22:55 -0500

In Ocata release, you will encounter this error:

# openstack role list --user swift
Listing assignments using role list is deprecated. Use role assignment list --user <user-name> --domain default --names instead.

Then you use this instead

# openstack role assignment list --names
+---------------+--------------------+-------+------------------+--------+-----------+
| Role          | User               | Group | Project          | Domain | Inherited |
+---------------+--------------------+-------+------------------+--------+-----------+
| admin         | neutron@Default    |       | services@Default |        | False     |
| admin         | placement@Default  |       | services@Default |        | False     |
| admin         | glance@Default     |       | services@Default |        | False     |
| admin         | cinder@Default     |       | services@Default |        | False     |
| admin         | aodh@Default       |       | services@Default |        | False     |
| admin         | admin@Default      |       | admin@Default    |        | False     |
| admin         | nova@Default       |       | services@Default |        | False     |
| admin         | swift@Default      |       | services@Default |        | False     |
| admin         | gnocchi@Default    |       | services@Default |        | False     |
| ResellerAdmin | ceilometer@Default |       | services@Default |        | False     |
| admin         | ceilometer@Default |       | services@Default |        | False     |
+---------------+--------------------+-------+------------------+--------+-----------+
edit flag offensive delete link more
0

answered 2015-01-06 20:06:37 -0500

9lives gravatar image

besides to what Haneef mentioned using the unified openstack client you can also use the keystone v3 rest api to do that excerpt from keystone v3 api ref http://developer.openstack.org/api-re...

v3/domains/​{domain_id}​/users/​{user_id}​/roles
List roles for domain user
Lists roles for a user on a domain.


close
Normal response codes
200
Error response codes
Bad Request (400), Unauthorized (401), Forbidden (403), Method Not Allowed (405), Request Entity Too Large (413), Service Unavailable (503), Not Found (404)
Request parameters
Parameter   Style   Type    Description
domain_id   URI capi:uuid   
The domain ID.

user_id URI capi:uuid   
The user ID.

[
    {
        "id": "--role-id--",
        "name": "--role-name--"
    },
    {
        "id": "--role-id--",
        "name": "--role-name--"
    }
]
This operation does not accept a request body.

Hope that helps!

Vic

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2015-01-06 05:09:38 -0500

Seen: 8,116 times

Last updated: Jul 28 '17