mirror of
https://github.com/CopterExpress/clover.git
synced 2026-05-27 05:29:32 +00:00
selfcheck.py: catch some more exceptions
This commit is contained in:
@@ -606,10 +606,16 @@ def check_cpu_usage():
|
||||
|
||||
@check('clever.service')
|
||||
def check_clever_service():
|
||||
output = subprocess.check_output('systemctl show -p ActiveState --value clever.service'.split())
|
||||
try:
|
||||
output = subprocess.check_output('systemctl show -p ActiveState --value clever.service'.split(),
|
||||
stderr=subprocess.STDOUT)
|
||||
except subprocess.CalledProcessError as e:
|
||||
failure('systemctl returned %s: %s', e.returncode, e.output)
|
||||
return
|
||||
if 'inactive' in output:
|
||||
failure('clever.service is not running, try sudo systemctl restart clever')
|
||||
return
|
||||
|
||||
j = journal.Reader()
|
||||
j.this_boot()
|
||||
j.add_match(_SYSTEMD_UNIT='clever.service')
|
||||
@@ -632,7 +638,10 @@ def check_clever_service():
|
||||
|
||||
@check('Image')
|
||||
def check_image():
|
||||
info('version: %s', open('/etc/clever_version').read().strip())
|
||||
try:
|
||||
info('version: %s', open('/etc/clever_version').read().strip())
|
||||
except IOError:
|
||||
info('no /etc/clever_version file, not the Clever image?')
|
||||
|
||||
|
||||
@check('Preflight status')
|
||||
|
||||
Reference in New Issue
Block a user