From 08d658e1f9038b2dae11d655416b7588b388762f Mon Sep 17 00:00:00 2001 From: Arif Ali Date: Thu, 3 Nov 2022 11:50:08 +0000 Subject: [PATCH] use service catalog to grab the endpoint URL --- check_openstack.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/check_openstack.py b/check_openstack.py index 548051b..fd92b28 100644 --- a/check_openstack.py +++ b/check_openstack.py @@ -16,6 +16,9 @@ def get_credentials(site_id): creds['version'] = '2' return creds +def get_keystoneclient(creds): + return keystone_auth(**creds) + def get_auth_token(creds): keystone_client = keystone_auth(**creds) @@ -27,9 +30,10 @@ def get_servers(creds): print(nova_client.servers.list()) def get_cores(creds): - url="http://placement.example.com:8778" + keystone = get_keystoneclient(creds) + token = keystone.auth_token - token = get_auth_token(creds) + url = keystone.service_catalog.get_endpoints(service_name="placement",endpoint_type="public")['placement'][0]['url'] headers = {} headers['content-type'] = 'application/json'