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'