Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F27207212
check_software_version
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
check_software_version
View Options
#!/usr/bin/env python3
# -------------------------------------------------------------
# Platform checks - Software version
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# Description: Check if softwareversions is up-to-date
# License: BSD-2-Clause
# -------------------------------------------------------------
import
sys
from
platformchecks
import
exitcode
from
platformchecks.checks
import
SoftwareVersionCheck
from
platformchecks.config
import
parse_config
# -------------------------------------------------------------
# Configuration
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def
get_software_list
():
return
parse_config
()
.
get
(
"checks"
,
{})
.
get
(
"check_software_version"
,
[])
# -------------------------------------------------------------
# Application entry point
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def
run_all
(
software_list
):
success
=
True
messages
=
[]
for
software
in
software_list
:
check
=
SoftwareVersionCheck
(
software
)
check_success
,
message
=
check
.
perform
()
success
&=
check_success
messages
.
append
(
f
"
{
software
}
{
message
}
"
)
print
(
"
\n
"
.
join
(
messages
))
return
exitcode
.
ok_or_critical
(
success
)
def
run
(
software
):
check
=
SoftwareVersionCheck
(
software
)
success
,
message
=
check
.
perform
()
print
(
message
)
return
exitcode
.
ok_or_critical
(
success
)
if
__name__
==
"__main__"
:
argc
=
len
(
sys
.
argv
)
if
argc
<
2
:
exitCode
=
run_all
(
get_software_list
())
else
:
exitCode
=
run
(
sys
.
argv
[
1
])
sys
.
exit
(
exitCode
)
File Metadata
Details
Attached
Mime Type
text/x-python
Expires
Sun, May 3, 05:28 (1 d, 18 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3671552
Default Alt Text
check_software_version (1 KB)
Attached To
Mode
rCHECKS Nasqueron platform checks
Attached
Detach File
Event Timeline
Log In to Comment