##############################################################################
-# Copyright (c) 2018 Nokia Corporation and others.
+# Copyright (c) 2019 Nokia Corporation and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
def __init__(self, trasport_url, conf, log):
self.conf = conf
self.log = log
+ self.admin_session = get_session()
self.keystone = keystone_client(
self.conf.keystone_version, get_session())
self.nova = nova_client(conf.nova_version, get_session())
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'}
-
+ if self.conf.admin_tool.type == 'fenix':
+ headers['X-Auth-Token'] = self.admin_session.get_token()
+ self.log.info('headers %s' % headers)
retries = 12
+ ret = None
while retries > 0:
# let's start maintenance 20sec from now, so projects will have
# time to ACK to it before that
time.sleep(10)
continue
break
+ if not ret:
+ raise Exception("admin tool did not respond")
if ret.status_code != 200:
raise Exception(ret.text)
return ret.json()['session_id']
'Content-Type': 'application/json',
'Accept': 'application/json'}
+ if self.conf.admin_tool.type == 'fenix':
+ headers['X-Auth-Token'] = self.admin_session.get_token()
+
ret = requests.delete(url, data=None, headers=headers)
if ret.status_code != 200:
raise Exception(ret.text)
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'}
+
+ if self.conf.admin_tool.type == 'fenix':
+ headers['X-Auth-Token'] = self.admin_session.get_token()
+
ret = requests.get(url, data=None, headers=headers)
if ret.status_code != 200:
raise Exception(ret.text)