use clouds.yaml instead for the auth params

This commit is contained in:
Arif Ali 2022-11-03 11:17:18 +00:00
parent af0d2be35c
commit d26633b37e
Signed by: arif
GPG Key ID: 369608FBA1353A70

View File

@ -2,21 +2,17 @@
import os
import requests
import yaml
from novaclient.client import Client as nova_auth
from keystoneclient.v3.client import Client as keystone_auth
def get_credentials():
cred = {}
cred['version'] = '2'
cred['username'] = "admin"
cred['password'] = "openstack"
cred['auth_url'] = "http://10.0.1.216:5000/v3"
cred['project_name'] = "admin"
cred['user_domain_name'] = "admin_domain"
cred['project_domain_name'] = "admin_domain"
with open('/home/arif/clouds.yaml','r') as stream:
creds = yaml.safe_load(stream)['clouds']['arif-home']['auth']
return cred
creds['version'] = '2'
return creds
def get_auth_token():
creds = get_credentials()