summaryrefslogtreecommitdiffstats
path: root/doctor_tests/scenario/maintenance.py
diff options
context:
space:
mode:
authorTomi Juvonen <tomi.juvonen@nokia.com>2018-12-21 12:43:57 +0200
committerTomi Juvonen <tomi.juvonen@nokia.com>2019-03-26 15:53:28 +0200
commit73605c5c34b97ab56306bfa9af0f5888f3c7e46d (patch)
tree7175ebaec5ed949d32ee62b7ac412729b366446e /doctor_tests/scenario/maintenance.py
parent33293e9c23a21ad3228f46d2063f18c915eb2b79 (diff)
Support Fenix as admin tool
If ADMIN_TOOL_TYPE=fenix we run maintenance testing using Fenix instead of sample implementation. Testing will build Fenix Docker container from latest master and make configuration according to controller host. JIRA: DOCTOR-131 Change-Id: I84c566b7afc3c4e488aeed63b5cf5c75046d1427 Signed-off-by: Tomi Juvonen <tomi.juvonen@nokia.com>
Diffstat (limited to 'doctor_tests/scenario/maintenance.py')
-rw-r--r--doctor_tests/scenario/maintenance.py41
1 files changed, 29 insertions, 12 deletions
diff --git a/doctor_tests/scenario/maintenance.py b/doctor_tests/scenario/maintenance.py
index a2129f61..7c2c17e0 100644
--- a/doctor_tests/scenario/maintenance.py
+++ b/doctor_tests/scenario/maintenance.py
@@ -142,22 +142,39 @@ class Maintenance(object):
(self.conf.admin_tool.ip,
self.conf.admin_tool.port,
self.endpoint))
-
- # let's start maintenance 20sec from now, so projects will have
- # time to ACK to it before that
- maintenance_at = (datetime.datetime.utcnow() +
- datetime.timedelta(seconds=30)
- ).strftime('%Y-%m-%d %H:%M:%S')
- data = {'hosts': maintenance_hosts,
- 'state': 'MAINTENANCE',
- 'maintenance_at': maintenance_at,
- 'metadata': {'openstack_version': 'Rocky'},
- 'workflow': 'default'}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'}
- ret = requests.post(url, data=json.dumps(data), headers=headers)
+ retries = 12
+ while retries > 0:
+ # let's start maintenance 20sec from now, so projects will have
+ # time to ACK to it before that
+ maintenance_at = (datetime.datetime.utcnow() +
+ datetime.timedelta(seconds=30)
+ ).strftime('%Y-%m-%d %H:%M:%S')
+
+ data = {'state': 'MAINTENANCE',
+ 'maintenance_at': maintenance_at,
+ 'metadata': {'openstack_version': 'Rocky'},
+ 'workflow': 'default'}
+
+ if self.conf.admin_tool.type == 'sample':
+ data['hosts'] = maintenance_hosts
+ else:
+ data['hosts'] = []
+ try:
+ ret = requests.post(url, data=json.dumps(data),
+ headers=headers)
+ except:
+ if retries == 0:
+ raise Exception('admin tool did not respond in 120s')
+ else:
+ self.log.info('admin tool not ready, retry in 10s')
+ retries = retries - 1
+ time.sleep(10)
+ continue
+ break
if ret.status_code != 200:
raise Exception(ret.text)
return ret.json()['session_id']