Skip to content

Commit

Permalink
Revert commit: Health check verify all clones
Browse files Browse the repository at this point in the history
  • Loading branch information
fmarco76 committed Aug 3, 2023
1 parent db3b7f4 commit e916c2f
Showing 1 changed file with 40 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class ClonesConnectivyAndDataCheck(ClonesPlugin):
Assure master and clones within a pki instance are reachable
"""
def check_ca_clones(self):
host_error = []
for host in self.clone_cas:
cur_clone_msg = ' Host: ' + host.Hostname + ' Port: ' + host.SecurePort
# Reach out and get some certs, to serve as a data and connectivity check
Expand All @@ -41,13 +40,11 @@ def check_ca_clones(self):
raise BaseException('CA clone problem reading data.' + cur_clone_msg)
except BaseException as e:
logger.error("Internal server error %s", e)
host_error.append(
BaseException('Internal error testing CA clone.' + cur_clone_msg))
raise BaseException('Internal error testing CA clone.' + cur_clone_msg)

return host_error
return

def check_kra_clones(self):
host_error = []
for host in self.clone_kras:

url = 'https://' + host.Hostname + ':' + host.SecurePort
Expand All @@ -61,15 +58,13 @@ def check_kra_clones(self):
logger.info('KRA at %s is %s', url, status)

if status != 'running':
raise BaseException('KRA at %s is %s' % (url, status))
raise Exception('KRA at %s is %s' % (url, status))

except BaseException as e:
except Exception as e:
logger.error('Unable to reach KRA at %s: %s', url, e)
host_error.append(BaseException('Unable to reach KRA at %s: %s' % (url, e)))
return host_error
raise Exception('Unable to reach KRA at %s: %s' % (url, e))

def check_ocsp_clones(self):
host_error = []
for host in self.clone_ocsps:

url = 'https://' + host.Hostname + ':' + host.SecurePort
Expand All @@ -83,15 +78,13 @@ def check_ocsp_clones(self):
logger.info('OCSP at %s is %s', url, status)

if status != 'running':
raise BaseException('OCSP at %s is %s' % (url, status))
raise Exception('OCSP at %s is %s' % (url, status))

except BaseException as e:
except Exception as e:
logger.error('Unable to reach OCSP at %s: %s', url, e)
host_error.append(BaseException('Unable to reach OCSP at %s: %s' % (url, e)))
return host_error
raise Exception('Unable to reach OCSP at %s: %s' % (url, e))

def check_tks_clones(self):
host_error = []
for host in self.clone_tkss:

url = 'https://' + host.Hostname + ':' + host.SecurePort
Expand All @@ -105,15 +98,13 @@ def check_tks_clones(self):
logger.info('TKS at %s is %s', url, status)

if status != 'running':
raise BaseException('TKS at %s is %s' % (url, status))
raise Exception('TKS at %s is %s' % (url, status))

except BaseException as e:
except Exception as e:
logger.error('Unable to reach TKS at %s: %s', url, e)
host_error.append(BaseException('Unable to reach TKS at %s: %s' % (url, e)))
return host_error
raise Exception('Unable to reach TKS at %s: %s' % (url, e))

def check_tps_clones(self):
host_error = []
for host in self.clone_tpss:

url = 'https://' + host.Hostname + ':' + host.SecurePort
Expand All @@ -127,12 +118,11 @@ def check_tps_clones(self):
logger.info('TPS at %s is %s', url, status)

if status != 'running':
raise BaseException('TPS at %s is %s' % (url, status))
raise Exception('TPS at %s is %s' % (url, status))

except BaseException as e:
except Exception as e:
logger.error('Unable to reach TPS at %s: %s', url, e)
host_error.append(BaseException('Unable to reach TPS at %s: %s' % (url, e)))
return host_error
raise Exception('Unable to reach TPS at %s: %s' % (url, e))

@duration
def check(self):
Expand All @@ -157,55 +147,51 @@ def check(self):
logger.info('About to check the subsystem clones')

hard_msg = ' Clones tested successfully, or not present.'
host_error = self.check_ca_clones()
if not host_error:
try:
self.check_ca_clones()
yield Result(self, constants.SUCCESS,
instance_name=self.instance.name,
status='CA' + hard_msg)
else:
for err in host_error:
yield Result(self, constants.ERROR,
status='ERROR: %s' % self.instance.name + ' : ' + str(err))

host_error = self.check_kra_clones()
if not host_error:
except BaseException as e:
yield Result(self, constants.ERROR,
status='ERROR: %s' % self.instance.name + ' : ' + str(e))

try:
self.check_kra_clones()
yield Result(self, constants.SUCCESS,
instance_name=self.instance.name,
status='KRA' + hard_msg)
else:
for err in host_error:
yield Result(self, constants.ERROR,
status='ERROR: %s' % self.instance.name + ' : ' + str(err))
except BaseException as e:
yield Result(self, constants.ERROR,
status='ERROR: %s' % self.instance.name + ' : ' + str(e))

host_error = self.check_ocsp_clones()
if not host_error:
try:
self.check_ocsp_clones()
yield Result(self, constants.SUCCESS,
instance_name=self.instance.name,
status='OCSP' + hard_msg)
else:
for err in host_error:
yield Result(self, constants.ERROR,
status='ERROR: %s' % self.instance.name + ' : ' + str(err))
except BaseException as e:
yield Result(self, constants.ERROR,
status='ERROR: %s' % self.instance.name + ' : ' + str(e))

host_error = self.check_tks_clones()
if not host_error:
try:
self.check_tks_clones()
yield Result(self, constants.SUCCESS,
instance_name=self.instance.name,
status='TKS' + hard_msg)
else:
for err in host_error:
yield Result(self, constants.ERROR,
status='ERROR: %s' % self.instance.name + ' : ' + str(err))
except BaseException as e:
yield Result(self, constants.ERROR,
status='ERROR: %s' % self.instance.name + ' : ' + str(e))

host_error = self.check_tps_clones()
if not host_error:
try:
self.check_tps_clones()
yield Result(self, constants.SUCCESS,
instance_name=self.instance.name,
status="TPS Clones tested successfully, or not present.")
else:
for err in host_error:
yield Result(self, constants.ERROR,
status='ERROR: %s' % self.instance.name + ' : ' + str(err))
except BaseException as e:
yield Result(self, constants.ERROR,
status='ERROR: %s' % self.instance.name + ' : ' + str(e))
else:
yield Result(self, constants.SUCCESS,
instance_name=self.instance.name,
Expand Down

0 comments on commit e916c2f

Please sign in to comment.