From: Mer.xuanyi Date: Tue, 16 Aug 2022 08:34:26 +0000 (+0800) Subject: mgr/snap-schedule: use the right way to check the result returned by fetchone() X-Git-Tag: v16.2.15~23^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9d34c02d06100725f1f51f67cc6fb561140fcc0a;p=ceph.git mgr/snap-schedule: use the right way to check the result returned by fetchone() Fixes: https://tracker.ceph.com/issues/57138 Signed-off-by: Mer Xuanyi (cherry picked from commit ac5f64e86b53a84bfd649d8f35553aff50803898) --- diff --git a/src/pybind/mgr/snap_schedule/fs/schedule.py b/src/pybind/mgr/snap_schedule/fs/schedule.py index 773a0694af9..182d8a28d68 100644 --- a/src/pybind/mgr/snap_schedule/fs/schedule.py +++ b/src/pybind/mgr/snap_schedule/fs/schedule.py @@ -282,7 +282,7 @@ class Schedule(object): (path,)) row = cur.fetchone() - if len(row) == 0: + if row is None: log.info(f'no schedule for {path} found') raise ValueError('SnapSchedule for {} not found'.format(path))