2
0
mirror of https://opendev.org/x/pyghmi synced 2025-02-20 12:30:48 +00:00

Check XCC HTTP service health

If the service is unreachable, emit an error
explaining the situation more clearly.

Change-Id: I5cc04d7fbec31869e9248936718543e480e60e29
This commit is contained in:
Jarrod Johnson 2019-07-19 15:16:42 -04:00
parent cfb50d0598
commit f26fc5401d

View File

@ -1,7 +1,7 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# coding=utf8
# Copyright 2016-2018 Lenovo
# Copyright 2016-2019 Lenovo
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -1729,6 +1729,15 @@ class XCCClient(IMMClient):
def get_health(self, summary):
wc = self.get_webclient(False)
if not wc:
summary['health'] = pygconst.Health.Critical;
summary['badreadings'].append(
sdr.SensorReading({'name': 'HTTPS Service',
'states': ['Unreachable'],
'state_ids': [3],
'health': pygconst.Health.Critical,
'type': 'BMC'}, ''))
raise pygexc.BypassGenericBehavior()
rsp = wc.grab_json_response('/api/providers/imm_active_events')
if 'items' in rsp and len(rsp['items']) == 0:
ledcheck = self.wc.grab_json_response(
@ -1846,4 +1855,4 @@ class XCCClient(IMMClient):
if days == 366:
return 0
else:
return days
return days