from .call_wrappers import call_throws, CallVerbosity
from .context import CephadmContext
from .container_engine_base import ContainerEngine
-from .constants import DEFAULT_MODE, MIN_PODMAN_VERSION
+from .constants import (
+ CGROUPS_SPLIT_PODMAN_VERSION,
+ DEFAULT_MODE,
+ MIN_PODMAN_VERSION,
+)
from .exceptions import Error
version = '.'.join(map(str, self.version))
return f'{self.EXE} ({self.path}) version {version}'
+ @property
+ def supports_split_cgroups(self) -> bool:
+ """Return true if this version of podman supports split cgroups."""
+ return self.version >= CGROUPS_SPLIT_PODMAN_VERSION
+
class Docker(ContainerEngine):
EXE = 'docker'
podman = mock.Mock(Podman)
podman.path = '/usr/bin/podman'
podman.version = (2, 1, 0)
+ # This next little bit of black magic was adapated from the mock docs for
+ # PropertyMock. We don't use a PropertyMock but the suggestion to call
+ # type(...) from the doc allows us to "borrow" the real
+ # supports_split_cgroups attribute:
+ # https://docs.python.org/3/library/unittest.mock.html#unittest.mock.Mock
+ type(podman).supports_split_cgroups = Podman.supports_split_cgroups
return podman