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: v18.0.0~191^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ac5f64e86b53a84bfd649d8f35553aff50803898;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 --- diff --git a/src/pybind/mgr/snap_schedule/fs/schedule.py b/src/pybind/mgr/snap_schedule/fs/schedule.py index d0c9f1098b47..afd56fba960b 100644 --- a/src/pybind/mgr/snap_schedule/fs/schedule.py +++ b/src/pybind/mgr/snap_schedule/fs/schedule.py @@ -296,7 +296,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))