mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-11-01 10:22:08 +00:00
fix: retain translated reboot summary in cached health responses
This commit is contained in:
@@ -108,7 +108,12 @@ def refresh_health_reboot(snapshot):
|
||||
if status in issues:
|
||||
label = key.replace('_', ' ').capitalize()
|
||||
reason = block.get('reason')
|
||||
issues[status].append(f'{label}: {reason}' if reason else label)
|
||||
if key == 'updates' and not reason:
|
||||
# Reuse the existing localized reboot detail contract rather
|
||||
# than introducing an untranslated, context-free "Updates".
|
||||
issues[status].append(block['checks']['reboot_required']['detail'])
|
||||
else:
|
||||
issues[status].append(f'{label}: {reason}' if reason else label)
|
||||
result['overall'] = ('CRITICAL' if issues['CRITICAL'] else 'WARNING'
|
||||
if issues['WARNING'] or issues['UNKNOWN'] else 'OK')
|
||||
primary = next((values for values in issues.values() if values), [])
|
||||
|
||||
@@ -63,6 +63,7 @@ class FullHealth(unittest.TestCase):
|
||||
self.assertTrue(result['health']['details']['updates']['reboot_required'])
|
||||
self.assertEqual(result['health']['details']['updates']['count'], 0)
|
||||
self.assertEqual(result['health']['timestamp'], 'original')
|
||||
self.assertEqual(result['health']['summary'], 'Reboot required: running 7.0.14-25-pve; installed 7.0.14-26-pve')
|
||||
self.assertEqual(self.cached, before)
|
||||
self.owner.get_detailed_status.assert_not_called()
|
||||
self.assertEqual(self.probe.call_count, 1)
|
||||
|
||||
Reference in New Issue
Block a user