summaryrefslogtreecommitdiffstats
path: root/doctor_tests/scenario
diff options
context:
space:
mode:
authorTomi Juvonen <tomi.juvonen@nokia.com>2019-11-07 13:09:45 +0200
committerTomi Juvonen <tomi.juvonen@nokia.com>2019-11-19 06:58:07 +0000
commita0528f67abe01f0bb4be3565cfef4fd049afa1fa (patch)
tree04b542e405e951067a8a65b09ce8a0e6ebf7e09b /doctor_tests/scenario
parente961ab783887a9c44d2a321df646f1c49f83b299 (diff)
Maintenance support for latest Fenix, python3 and Fuel
JIRA: DOCTOR-134 Signed-off-by: Tomi Juvonen <tomi.juvonen@nokia.com> Change-Id: I51a93637f30b0eece2075a8277616fb97a1b230e
Diffstat (limited to 'doctor_tests/scenario')
-rw-r--r--doctor_tests/scenario/maintenance.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/doctor_tests/scenario/maintenance.py b/doctor_tests/scenario/maintenance.py
index 7c2c17e0..2e40529f 100644
--- a/doctor_tests/scenario/maintenance.py
+++ b/doctor_tests/scenario/maintenance.py
@@ -1,5 +1,5 @@
##############################################################################
-# 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
@@ -28,6 +28,7 @@ class Maintenance(object):
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())
@@ -145,8 +146,11 @@ class Maintenance(object):
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
@@ -175,6 +179,8 @@ class Maintenance(object):
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']
@@ -191,6 +197,9 @@ class Maintenance(object):
'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)
@@ -205,6 +214,10 @@ class Maintenance(object):
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)