Add health check to cic-eth-tasker

This commit is contained in:
nolash
2021-04-19 12:46:23 +02:00
parent d7bc76ac28
commit 3eaca2577e
9 changed files with 37 additions and 9 deletions

View File

@@ -0,0 +1 @@
include *health*.sh

View File

@@ -14,14 +14,15 @@ def load(namespace, check_strs, rundir='/run'):
checks = []
for m in check_strs:
logg.debug('added liveness check module {}'.format(str(m)))
logg.debug('added liveness check: {}'.format(str(m)))
module = importlib.import_module(m)
checks.append(module)
for check in checks:
r = check.health()
if r == False:
raise RuntimeError('check {} failed'.format(str(check)))
raise RuntimeError('liveness check {} failed'.format(str(check)))
logg.info('liveness check passed: {}'.format(str(check)))
app_rundir = os.path.join(rundir, namespace)
os.makedirs(app_rundir) # should not already exist

View File

@@ -0,0 +1,7 @@
from setuptools import setup
setup(
name='liveness',
version='0.0.1a2',
packages=['liveness'],
include_package_data=True,
)