]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/snap-schedule: cleanup code 53355/head
authorMer.xuanyi <xuanyi.meng@xtao.tech.com>
Tue, 16 Aug 2022 09:20:45 +0000 (17:20 +0800)
committerKonstantin Shalygin <k0ste@k0ste.ru>
Sun, 10 Sep 2023 08:13:26 +0000 (15:13 +0700)
Signed-off-by: Mer Xuanyi <xuanyi.meng@xtaotech.com>
(cherry picked from commit 46f82c67f0a125ec472287f088d146315f137b23)

src/pybind/mgr/snap_schedule/fs/schedule.py

index 182d8a28d6851060fed63b913620b62675072967..1bb1861ca676ab7c682ec5ba8d6f689622a19ffb 100644 (file)
@@ -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']