fix: retain translated reboot summary in cached health responses

This commit is contained in:
VAIO73
2026-10-28 17:30:44 +00:00
parent ac9565fa19
commit 503a946d85
2 changed files with 7 additions and 1 deletions
+6 -1
View File
@@ -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), [])
+1
View File
@@ -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)