From: Mer.xuanyi Date: Tue, 16 Aug 2022 09:20:45 +0000 (+0800) Subject: mgr/snap-schedule: cleanup code X-Git-Tag: v16.2.15~23^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=00bc814c48d72c126e7d30deac1fdbf87831bf61;p=ceph.git mgr/snap-schedule: cleanup code Signed-off-by: Mer Xuanyi (cherry picked from commit 46f82c67f0a125ec472287f088d146315f137b23) --- diff --git a/src/pybind/mgr/snap_schedule/fs/schedule.py b/src/pybind/mgr/snap_schedule/fs/schedule.py index 182d8a28d68..1bb1861ca67 100644 --- a/src/pybind/mgr/snap_schedule/fs/schedule.py +++ b/src/pybind/mgr/snap_schedule/fs/schedule.py @@ -327,7 +327,7 @@ class Schedule(object): def add_retention(cls, db, path, retention_spec): with db: row = db.execute(cls.GET_RETENTION, (path,)).fetchone() - if not row: + if row is None: raise ValueError(f'No schedule found for {path}') retention = parse_retention(retention_spec) if not retention: @@ -346,7 +346,7 @@ class Schedule(object): def rm_retention(cls, db, path, retention_spec): with db: row = db.execute(cls.GET_RETENTION, (path,)).fetchone() - if not row: + if row is None: raise ValueError(f'No schedule found for {path}') retention = parse_retention(retention_spec) current = row['retention']