mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
performance: Cleanup code meant for cockpit version < 235
Bullseye and higher has version 239 or higher. Tests: - From performance app, launch the web interface in a testing container. Web interface shows up properly. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
9faeedbf8f
commit
ebd357476d
@ -3,36 +3,12 @@
|
||||
FreedomBox app for System Monitoring (cockpit-pcp) in ‘System’.
|
||||
"""
|
||||
|
||||
import subprocess
|
||||
from functools import lru_cache
|
||||
|
||||
from django.utils.functional import lazy
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from plinth.utils import Version
|
||||
|
||||
|
||||
@lru_cache()
|
||||
def _get_url():
|
||||
"""Return the web client URL based on Cockpit version."""
|
||||
process = subprocess.run(
|
||||
['dpkg-query', '--showformat=${Version}', '--show', 'cockpit'],
|
||||
stdout=subprocess.PIPE)
|
||||
cockpit_version = process.stdout.decode()
|
||||
if Version(cockpit_version) >= Version('235'):
|
||||
url = '/_cockpit/metrics'
|
||||
else:
|
||||
url = '/_cockpit/system/graphs'
|
||||
|
||||
return url
|
||||
|
||||
|
||||
get_url = lazy(_get_url, str)
|
||||
|
||||
clients = [{
|
||||
'name': _('Cockpit'),
|
||||
'platforms': [{
|
||||
'type': 'web',
|
||||
'url': get_url()
|
||||
'url': '/_cockpit/metrics'
|
||||
}]
|
||||
}]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user