Commit 155ed36c authored by Kerri Wait's avatar Kerri Wait
Browse files

Adding timestamp to the description field for HPC

parent 9b4401a1
......@@ -20,7 +20,10 @@ def main():
from .influxdbwrapper import Client as influxWrapperClient
from . import component_tests
from .status import Status
import datetime
global ts
ts = datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S")
with open(args.config) as f:
config = yaml.safe_load(f.read())
......@@ -32,14 +35,12 @@ def main():
for c in spClient.components.list():
spcomponents[c['name']] = c
logger.debug("found component {}".format(c['name']))
for name,c in config['components'].items():
msgs = []
overall = Status.operational
if name not in spcomponents:
logger.error("Can't find component {}".format(name))
if name in spcomponents and spcomponents[name]['status'] == 'under_maintenance':
continue
for t in c['tests']:
......@@ -50,10 +51,10 @@ def main():
if result['status'] != Status.operational:
msgs.append(result['msg'])
if name in spcomponents:
update_component(spClient,spcomponents[name],overall,"\n".join(msgs),check=args.check)
update_component(spClient,spcomponents[name],overall,"\n".join(msgs),check=args.check,description=c['desc'])
#update_incident(spclient,spcomponents[name],overall,"\n".join(msgs),open_incidents)
def update_component(spclient,component,status,msg,check):
def update_component(spclient,component,status,msg,check,description):
from .status import Status
if status is Status.operational:
......@@ -66,7 +67,7 @@ def update_component(spclient,component,status,msg,check):
statusstr = 'under_maintenance'
if not check:
if statusstr != component['status']:
spclient.components.update(component.id, status = statusstr)
spclient.components.update(component.id, status = statusstr, description = "{}. Updated {}".format(description, ts))
else:
if statusstr == component['status']:
print("no change {} {} {}".format(component['name'],component['status'], statusstr))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment