Able to search catalog

This commit is contained in:
Cory Hawkless 2022-10-13 12:55:57 +10:30
parent 581b605b0e
commit 74ebac01fd
2 changed files with 16 additions and 8 deletions

View File

@ -11,9 +11,9 @@ x.keystone.getCatalog()
# print (x.keystone.catalogData)
neutronService=x.keystone.getServicebyName("Neutron")
print(neutronService)
neutronEndpointInternal=x.keystone.getEndpointByServiceIDAndInterface(neutronService['id'],"internal")
# neutronService=x.keystone.getServicebyName("Neutron")
# print(neutronService)
neutronEndpointInternal=x.keystone.getEndpointByNameIDAndInterface("NeuTrOn","internal")
print(neutronEndpointInternal)
# token = ng_openstack.auth.getToken(os.getenv("OS_USERNAME"), os.getenv("OS_PASSWORD"),

View File

@ -52,3 +52,11 @@ class Openstack_Keystone():
if str(_endpoint['interface']).lower()==str(interface).lower():
# print(_endpoint)
return(_endpoint)
def getEndpointByNameIDAndInterface(_self,name,interface):
serviceID=_self.getServicebyName(name)['id']
for _endpoint in _self.catalogData['endpoints']:
if str(_endpoint['service_id']).lower()==str(id).lower():
if str(_endpoint['interface']).lower()==str(interface).lower():
# print(_endpoint)
return(_endpoint)