]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/rbd_support: fix schedule remove
authorSunny Kumar <sunkumar@redhat.com>
Fri, 12 Nov 2021 16:27:55 +0000 (16:27 +0000)
committerSunny Kumar <sunkumar@redhat.com>
Fri, 4 Feb 2022 16:15:30 +0000 (16:15 +0000)
Issue:

If we provide a random string in the schedule remove
command the entire schedule at specified level gets
removed.

Fixes: https://tracker.ceph.com/issues/53250
Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
src/pybind/mgr/rbd_support/schedule.py

index ffcb78a0741226d057c8d17e00d1194b6c1ba7cf..615c002a043d9651dde483c95fbf23bcc2f87054 100644 (file)
@@ -512,10 +512,12 @@ class Schedules:
             if interval is None:
                 schedule = None
             else:
-                schedule.remove(Interval.from_string(interval),
-                                StartTime.from_string(start_time))
-                if schedule:
-                    self.schedules[level_spec.id] = schedule
+                try:
+                    schedule.remove(Interval.from_string(interval),
+                                    StartTime.from_string(start_time))
+                finally:
+                    if schedule:
+                        self.schedules[level_spec.id] = schedule
             if not schedule:
                 del self.level_specs[level_spec.id]
         self.save(level_spec, schedule)