Skip to content

Commit bc61710

Browse files
cephadm: move ContainerInfo class to container_engines.py
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 <[email protected]>
1 parent d0d4b60 commit bc61710

File tree

2 files changed

+29
-25
lines changed

2 files changed

+29
-25
lines changed

src/cephadm/cephadm.py

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
concurrent_tasks,
8686
)
8787
from cephadmlib.container_engines import (
88+
ContainerInfo,
8889
Podman,
8990
check_container_engine,
9091
find_container_engine,
@@ -200,30 +201,6 @@
200201
##################################
201202

202203

203-
class ContainerInfo:
204-
def __init__(self, container_id: str,
205-
image_name: str,
206-
image_id: str,
207-
start: str,
208-
version: str) -> None:
209-
self.container_id = container_id
210-
self.image_name = image_name
211-
self.image_id = image_id
212-
self.start = start
213-
self.version = version
214-
215-
def __eq__(self, other: Any) -> bool:
216-
if not isinstance(other, ContainerInfo):
217-
return NotImplemented
218-
return (self.container_id == other.container_id
219-
and self.image_name == other.image_name
220-
and self.image_id == other.image_id
221-
and self.start == other.start
222-
and self.version == other.version)
223-
224-
##################################
225-
226-
227204
def get_supported_daemons():
228205
# type: () -> List[str]
229206
supported_daemons = ceph_daemons()

src/cephadm/cephadmlib/container_engines.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import os
44
import logging
55

6-
from typing import Tuple, List, Optional, Dict
6+
from typing import Tuple, List, Optional, Dict, Any
77

88
from .call_wrappers import call_throws, call, CallVerbosity
99
from .context import CephadmContext
@@ -302,3 +302,30 @@ def parsed_container_cpu_perc(
302302
ctx, container_path=container_path, verbosity=verbosity
303303
)
304304
return _parse_cpu_perc(code, out)
305+
306+
307+
class ContainerInfo:
308+
def __init__(
309+
self,
310+
container_id: str,
311+
image_name: str,
312+
image_id: str,
313+
start: str,
314+
version: str,
315+
) -> None:
316+
self.container_id = container_id
317+
self.image_name = image_name
318+
self.image_id = image_id
319+
self.start = start
320+
self.version = version
321+
322+
def __eq__(self, other: Any) -> bool:
323+
if not isinstance(other, ContainerInfo):
324+
return NotImplemented
325+
return (
326+
self.container_id == other.container_id
327+
and self.image_name == other.image_name
328+
and self.image_id == other.image_id
329+
and self.start == other.start
330+
and self.version == other.version
331+
)

0 commit comments

Comments
 (0)