Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
hpc-team
statuspage_integration
Commits
155ed36c
Commit
155ed36c
authored
Aug 01, 2022
by
Kerri Wait
Browse files
Adding timestamp to the description field for HPC
parent
9b4401a1
Changes
1
Hide whitespace changes
Inline
Side-by-side
statuspage_integration/__main__.py
View file @
155ed36c
...
...
@@ -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
))
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment