Re: [openstack-dev] [Keystone] Listing Domain roles (or retrieving them by name)

2016-09-20 Thread Johannes Grassler

Hello,

On 09/20/2016 10:15 AM, Johannes Grassler wrote:

is there a canonical way to either

* list roles in a given domain
* or retrieve a role from a given domain by name (preferred)


Looks like there is a way:

  osc_lib.utils.find_resource(admin_client.roles, role_name,  
domain_id=domain_id)

returns a role object for the role I'm looking for.

(admin_client is the Keystone client's RoleManager, role_name contains the 
role's name).

Cheers,

Johannes

--
Johannes Grassler, Cloud Developer
SUSE Linux GmbH, HRB 21284 (AG Nürnberg)
GF: Felix Imendörffer, Jane Smithard, Graham Norton
Maxfeldstr. 5, 90409 Nürnberg, Germany

__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


[openstack-dev] [Keystone] Listing Domain roles (or retrieving them by name)

2016-09-20 Thread Johannes Grassler

Hello,

is there a canonical way to either

* list roles in a given domain
* or retrieve a role from a given domain by name (preferred)

keystoneclient.v3.roles.RoleManager.list() does not appear to do the trick. 
While it takes a
`domain` argument, it only returns roles with a domain_id=None attribute but 
none of the roles
in the domain I specified. Also, it appears to be deprecated if this comment[0] 
in
python-openstackclient is anything to go by.

As for why I want to do this: I attempt to create the role in question and 
catch the Conflict exception
that happens if a role with that name exists already. To use that existing role 
I need its UUID though
(or a role object as keystoneclient.v3.roles.RoleManager.create() would have 
returned if it were successful).
The name does not help since I cannot use that for 
keystoneclient.v3.roles.RoleManager.grant(). Come to
think of it, a way to grant roles on a domain by name would also solve the 
problem...

Cheers,

Johannes

[0] 
https://github.com/openstack/python-openstackclient/blob/master/openstackclient/identity/v3/role.py#L241

--
Johannes Grassler, Cloud Developer
SUSE Linux GmbH, HRB 21284 (AG Nürnberg)
GF: Felix Imendörffer, Jane Smithard, Graham Norton
Maxfeldstr. 5, 90409 Nürnberg, Germany

__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev