How to get region name in custom heat resource?
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?
You can try keystoneclient.v3.regions.RegionManager.list or keystoneclient.v3.regions.RegionManager.get
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