From 67a4110af54ead4999733109c56b9252eb2a8226 Mon Sep 17 00:00:00 2001 From: Redouane Kachach Date: Wed, 29 Jun 2022 17:13:48 +0200 Subject: [PATCH] mgr/cephadm: check for events key before accessing it Fixes: https://tracker.ceph.com/issues/55808 Signed-off-by: Redouane Kachach (cherry picked from commit 992d63849b005bdc97b89991060f11666965d536) --- qa/tasks/cephfs/test_nfs.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/qa/tasks/cephfs/test_nfs.py b/qa/tasks/cephfs/test_nfs.py index 47b3e63a6da9..1f439cd31831 100644 --- a/qa/tasks/cephfs/test_nfs.py +++ b/qa/tasks/cephfs/test_nfs.py @@ -83,11 +83,16 @@ class TestNFS(MgrTestCase): ''' event_occurred = False # Wait few seconds for NFS daemons' status to be updated - with contextutil.safe_while(sleep=10, tries=12, _raise=False) as proceed: + with contextutil.safe_while(sleep=10, tries=18, _raise=False) as proceed: while not event_occurred and proceed(): daemons_details = json.loads( self._fetch_nfs_daemons_details(enable_json=True)) log.info('daemons details %s', daemons_details) + # 'events' key may not exist in the daemon description + # after a mgr fail over and could take some time to appear + # (it's populated on first daemon event) + if 'events' not in daemons_details[0]: + continue for event in daemons_details[0]['events']: log.info('daemon event %s', event) if expected_event in event: -- 2.47.3