How to get region name in custom heat resource?

asked 2018-12-06 09:44:39 -0600

hg_mish gravatar image

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(
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/", 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?

edit retag flag offensive close merge delete


You can try keystoneclient.v3.regions.RegionManager.list or keystoneclient.v3.regions.RegionManager.get

Mohit gravatar imageMohit ( 2018-12-09 22:55:24 -0600 )edit

keystoneclient.v3.regions.RegionManager.list returns the same error "The service catalog is empty."

keystoneclient.v3.regions.RegionManager.get won't help because it needs region name as an argument and that is what I want to obtain

hg_mish gravatar imagehg_mish ( 2018-12-10 08:23:20 -0600 )edit