We want to authorize a tenant to access a private image.

Continuing from the example above, in order to share the image with ID 1 with 'tenant1', and to allow 'tenant2' to not only access the image but to also share it with other tenants, we can use the following code

from glance.client import Client

c = Client("glance.example.com", 9292)

c.add_member(1, 'tenant1') c.add_member(1, 'tenant2', True)

..note:

The Client.add_member() function takes one optional argument, the `can_share`
value.  If one is not provided and the membership already exists, its current
`can_share` setting is left alone.  If the membership does not already exist,
then the `can_share` setting will default to `False`, and the membership will
be created.  In all other cases, existing memberships will be modified to use
the specified `can_share` setting, and new memberships will be created with
it.  The return value of Client.add_member() is not significant.


loading table of contents...