From 5c96c510db6b0abd4ec0f4b8325dd1732e9b4ce2 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Sat, 4 Nov 2023 16:59:33 -0400 Subject: [PATCH] cephadm: always pass ctx to customize_container_{binds,mounts} These functions often derive the binds and/or mounts from the context variable. Thus we should have the base class method accept the context. Not all subclassess will use it but it will be there for those that do. Also, fix the type for customize_container_mounts - it should be a dict not a list. Signed-off-by: John Mulligan --- src/cephadm/cephadmlib/container_daemon_form.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/cephadm/cephadmlib/container_daemon_form.py b/src/cephadm/cephadmlib/container_daemon_form.py index 5aef951f37c..4da0624698b 100644 --- a/src/cephadm/cephadmlib/container_daemon_form.py +++ b/src/cephadm/cephadmlib/container_daemon_form.py @@ -2,7 +2,7 @@ import abc -from typing import List, Tuple, Optional +from typing import List, Tuple, Optional, Dict from .container_types import CephContainer, InitContainer from .context import CephadmContext @@ -39,13 +39,17 @@ class ContainerDaemonForm(DaemonForm): """ return [] - def customize_container_binds(self, binds: List[List[str]]) -> None: + def customize_container_binds( + self, ctx: CephadmContext, binds: List[List[str]] + ) -> None: """Given a list of container binds this function can update, delete, or otherwise mutate the binds that the container will use. """ pass - def customize_container_mounts(self, mounts: List[str]) -> None: + def customize_container_mounts( + self, ctx: CephadmContext, mounts: Dict[str, str] + ) -> None: """Given a list of container mounts this function can update, delete, or otherwise mutate the mounts that the container will use. """ -- 2.39.5