From: Redouane Kachach Date: Wed, 29 Jun 2022 15:13:48 +0000 (+0200) Subject: mgr/cephadm: check for events key before accessing it X-Git-Tag: v17.2.4~139^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F47317%2Fhead;p=ceph.git 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) --- 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: