]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: move ContainerInfo class to container_engines.py
authorJohn Mulligan <jmulligan@redhat.com>
Thu, 30 Jan 2025 22:54:22 +0000 (17:54 -0500)
committerJohn Mulligan <jmulligan@redhat.com>
Wed, 5 Feb 2025 18:13:05 +0000 (13:13 -0500)
Move the ContainerInfo class, which has basically no dependencies, to
container engines module which is the current home for generic
*low-level* container things.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/cephadm/cephadm.py
src/cephadm/cephadmlib/container_engines.py

index 4be352bfae089bcb5248324e39e3754883bfc038..cf7531f76389a243e342fcf2a231019870120510 100755 (executable)
@@ -85,6 +85,7 @@ from cephadmlib.call_wrappers import (
     concurrent_tasks,
 )
 from cephadmlib.container_engines import (
+    ContainerInfo,
     Podman,
     check_container_engine,
     find_container_engine,
@@ -200,30 +201,6 @@ logger = logging.getLogger()
 ##################################
 
 
-class ContainerInfo:
-    def __init__(self, container_id: str,
-                 image_name: str,
-                 image_id: str,
-                 start: str,
-                 version: str) -> None:
-        self.container_id = container_id
-        self.image_name = image_name
-        self.image_id = image_id
-        self.start = start
-        self.version = version
-
-    def __eq__(self, other: Any) -> bool:
-        if not isinstance(other, ContainerInfo):
-            return NotImplemented
-        return (self.container_id == other.container_id
-                and self.image_name == other.image_name
-                and self.image_id == other.image_id
-                and self.start == other.start
-                and self.version == other.version)
-
-##################################
-
-
 def get_supported_daemons():
     # type: () -> List[str]
     supported_daemons = ceph_daemons()
index af094ecbd54c22cecdcf7f3d53cf4674ef58e494..9eb2f622b8f17f73a426de3bdb28ab7c280a2b9d 100644 (file)
@@ -3,7 +3,7 @@
 import os
 import logging
 
-from typing import Tuple, List, Optional, Dict
+from typing import Tuple, List, Optional, Dict, Any
 
 from .call_wrappers import call_throws, call, CallVerbosity
 from .context import CephadmContext
@@ -302,3 +302,30 @@ def parsed_container_cpu_perc(
         ctx, container_path=container_path, verbosity=verbosity
     )
     return _parse_cpu_perc(code, out)
+
+
+class ContainerInfo:
+    def __init__(
+        self,
+        container_id: str,
+        image_name: str,
+        image_id: str,
+        start: str,
+        version: str,
+    ) -> None:
+        self.container_id = container_id
+        self.image_name = image_name
+        self.image_id = image_id
+        self.start = start
+        self.version = version
+
+    def __eq__(self, other: Any) -> bool:
+        if not isinstance(other, ContainerInfo):
+            return NotImplemented
+        return (
+            self.container_id == other.container_id
+            and self.image_name == other.image_name
+            and self.image_id == other.image_id
+            and self.start == other.start
+            and self.version == other.version
+        )