Add url to get dcimgr admin key
This commit is contained in:
parent
26f52e93aa
commit
e57c3209ed
11
main.py
11
main.py
@ -22,6 +22,7 @@ class Access(object):
|
|||||||
if platform == 'dci':
|
if platform == 'dci':
|
||||||
self.input_container = 'input'
|
self.input_container = 'input'
|
||||||
self.user_table = AuthUser
|
self.user_table = AuthUser
|
||||||
|
self.platform = platform
|
||||||
|
|
||||||
def get_admin(self):
|
def get_admin(self):
|
||||||
query_admin = (self.user_table.select(
|
query_admin = (self.user_table.select(
|
||||||
@ -46,8 +47,14 @@ class Access(object):
|
|||||||
|
|
||||||
def get_key(self, admin):
|
def get_key(self, admin):
|
||||||
host = self.input_container
|
host = self.input_container
|
||||||
admin_id = admin['id']
|
if self.platform == "vm":
|
||||||
url = 'http://{}:1500/auth/v4/user/{}/key'.format(host, admin_id)
|
url = 'http://{}:1500/auth/v4/user/{}/key'.format(
|
||||||
|
host, admin['id']
|
||||||
|
)
|
||||||
|
if self.platform == "dci":
|
||||||
|
url = 'http://{}:1500/auth/v3/user/{}/key'.format(
|
||||||
|
host, admin['email']
|
||||||
|
)
|
||||||
headers = {"Internal-Auth": "on", "Accept": "application/json"}
|
headers = {"Internal-Auth": "on", "Accept": "application/json"}
|
||||||
req = requests.post(url, headers=headers, data={})
|
req = requests.post(url, headers=headers, data={})
|
||||||
result = req.json()
|
result = req.json()
|
||||||
|
@ -19,7 +19,7 @@ if DB_PASSWORD is None:
|
|||||||
DB_PASSWORD = platform_config.get("MysqlRootPassword")
|
DB_PASSWORD = platform_config.get("MysqlRootPassword")
|
||||||
|
|
||||||
if PLATFORM == "dci":
|
if PLATFORM == "dci":
|
||||||
DB_NAME == "auth"
|
DB_NAME = "auth"
|
||||||
|
|
||||||
database = MySQLDatabase(
|
database = MySQLDatabase(
|
||||||
DB_NAME, **{
|
DB_NAME, **{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user