How to get region name in custom heat resource?

81 Views Asked by At

I have an OpenStack deployment with 2 regions. Keystone and Horizon are common for both regions. And each region has its own Nova, Heat, Neutron, Glance etc.

I am writing a custom heat resource which should behave differently depending on the region in which the stack is created. Therefore, I am looking for a way to get the region name in the custom heat resource.

I tried to experiment with different methods of keystoneclient, i.e.:

auth = keystoneclient.auth.identity.v3.Token(
    auth_url=auth_url,
    token=token,
    reauthenticate=False)
session = keystoneclient.session.Session(auth=auth)

keystone_client = keystoneclient.v3.client.Client(session=session)

endpoint_manager = keystoneclient.v3.endpoints.EndpointManager(keystone_client)
endpoint_list = endpoint_manager.list()

This code returns an error:

2018-12-06 14:27:11.885 1305729 TRACE heat.engine.resource   File "/usr/lib/python2.7/site-packages/keystoneclient/service_catalog.py", line 216, in url_for
2018-12-06 14:27:11.885 1305729 TRACE heat.engine.resource     raise exceptions.EmptyCatalog(_('The service catalog is empty.'))
2018-12-06 14:27:11.885 1305729 TRACE heat.engine.resource EmptyCatalog: The service catalog is empty.

Is there a "standard" way of getting the region name of your "own" region?

0

There are 0 best solutions below