From a648339314fac92e5b00993aec40551997e010c1 Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Fri, 27 Nov 2026 12:41:13 -0500 Subject: [PATCH] Ceph flags: 'set since before ' when older than Thor's flag history On prod, noout read 'set since 2026-11-26 17:28 UTC', which is only where the 24 h of flag history begins; it has been set much longer. Co-Authored-By: Claude Opus 5.5 --- tests/test_ceph.py | 5 ++++- thor/checks/ceph.py | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/test_ceph.py b/tests/test_ceph.py index 30c2eab..624271b 100644 --- a/tests/test_ceph.py +++ b/tests/test_ceph.py @@ -281,7 +281,10 @@ def test_a_known_condition_matches_a_flag_by_its_name(): e.process([f], T0) acts = e.process([f], T0 + 120) assert [(a.kind, a.payload.get('ticket_id')) for a in acts] == [('known_note', '693930698')] - assert e.incidents['cluster:ceph_flag:noout'].summary.startswith('Ceph flag noout set since ') + assert e.incidents['cluster:ceph_flag:noout'].summary.startswith('Ceph flag noout set since 20') + f.facts['run_start_open'] = True + e.process([f], T0 + 240) + assert e.incidents['cluster:ceph_flag:noout'].summary.startswith('Ceph flag noout set since before 20') def test_ticket_text_says_when_the_start_is_only_a_lower_bound(): diff --git a/thor/checks/ceph.py b/thor/checks/ceph.py index 5e5c87a..67ee3fa 100644 --- a/thor/checks/ceph.py +++ b/thor/checks/ceph.py @@ -392,7 +392,9 @@ class CephCheck: # Stable text: a summary that changes every cycle would re-send the ticket every 30 min. from ..ticket_text import utc since = utc(inc.facts.get('run_start', inc.first_seen))[:16] + ' UTC' - return f'Ceph flag {inc.facts.get("flag")} set since {since}' + # Set since before Thor's 24 h of flag history: the date is only a lower bound. + word = 'before ' if inc.facts.get('run_start_open') else '' + return f'Ceph flag {inc.facts.get("flag")} set since {word}{since}' return inc.summary @staticmethod -- 2.47.3