From 240b2435bad903b811a3279b0e7a5d0806ee0b93 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Mon, 19 Jul 2021 10:23:52 +0200 Subject: [PATCH] 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 --- src/cephadm/cephadm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 385d7500e3349..fb63399e65663 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -167,8 +167,9 @@ class ContainerEngine: def __init__(self): self.path = find_program(self.EXE) + @classmethod @property - def EXE(self) -> str: + def EXE(cls) -> str: raise NotImplementedError() @@ -1981,7 +1982,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: -- 2.39.5