From: Sebastian Wagner Date: Mon, 19 Jul 2021 08:23:52 +0000 (+0200) Subject: cephadm: Clarify no container engine message X-Git-Tag: v16.2.6~54^2~14 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f757d5139f28dab048fc2b56fe5604a69b6e3c09;p=ceph.git cephadm: Clarify no container engine message Multiple people didn't understand the message. Let's try to impove it. (Also make mypy happy) Signed-off-by: Sebastian Wagner (cherry picked from commit 240b2435bad903b811a3279b0e7a5d0806ee0b93) --- diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 20b7239b4288..f78dd4e1d4d8 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -170,8 +170,9 @@ class ContainerEngine: def __init__(self) -> None: self.path = find_program(self.EXE) + @classmethod @property - def EXE(self) -> str: + def EXE(cls) -> str: raise NotImplementedError() @@ -1998,7 +1999,9 @@ def check_container_engine(ctx): # type: (CephadmContext) -> None engine = ctx.container_engine if not isinstance(engine, CONTAINER_PREFERENCE): - raise Error('Unable to locate any of %s' % [i.EXE for i in CONTAINER_PREFERENCE]) + # See https://github.com/python/mypy/issues/8993 + exes: List[str] = [i.EXE for i in CONTAINER_PREFERENCE] # type: ignore + raise Error('No container engine binary found ({}). Try run `apt/dnf/yum/zypper install `'.format(' or '.join(exes))) elif isinstance(engine, Podman): engine.get_version(ctx) if engine.version < MIN_PODMAN_VERSION: