]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: add sorted_dependencies function
authorJohn Mulligan <jmulligan@redhat.com>
Mon, 9 Mar 2026 18:54:51 +0000 (14:54 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Thu, 26 Mar 2026 13:31:38 +0000 (09:31 -0400)
Add `sorted_dependencies` a light wrapper around get_dependencies that
enforces the invariant of returning a sorted list of dependencies.
In the future we may want to simply replace get_dependencies if
there's no place we don't want sorted dependencies but this keeps
the changes to a minimum for now.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/pybind/mgr/cephadm/services/cephadmservice.py

index abb4481d93a4383fa6a1c07b1104863ae2c853ce..d2ab1c4c2920fdd446c7e007ab961c4c35300313 100644 (file)
@@ -325,6 +325,18 @@ class CephadmService(metaclass=ABCMeta):
     ) -> List[str]:
         return []
 
+    @classmethod
+    def sorted_dependencies(
+        cls,
+        mgr: "CephadmOrchestrator",
+        spec: Optional[ServiceSpec] = None,
+        daemon_type: Optional[str] = None,
+    ) -> List[str]:
+        """A version of get_dependencies that guarantees that the returned
+        list is in sorted order.
+        """
+        return sorted(cls.get_dependencies(mgr, spec, daemon_type))
+
     def __init__(self, mgr: "CephadmOrchestrator"):
         self.mgr: "CephadmOrchestrator" = mgr