From: John Mulligan Date: Tue, 12 Sep 2023 18:22:25 +0000 (-0400) Subject: cephadm: add a data_dir method to DaemonIdentity X-Git-Tag: v19.0.0~452^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=353a927e5cef0f65ea84c1ba1df6296a0bc153a1;p=ceph.git cephadm: add a data_dir method to DaemonIdentity This will replace `get_data_dir` in a future commit. Signed-off-by: John Mulligan --- diff --git a/src/cephadm/cephadmlib/daemon_identity.py b/src/cephadm/cephadmlib/daemon_identity.py index f7e958ebf748..7fc4af1cb771 100644 --- a/src/cephadm/cephadmlib/daemon_identity.py +++ b/src/cephadm/cephadmlib/daemon_identity.py @@ -1,5 +1,7 @@ # deamon_identity.py - classes for identifying daemons & services +import os +import pathlib import re from typing import Union @@ -50,6 +52,9 @@ class DaemonIdentity: def unit_name(self) -> str: return f'ceph-{self.fsid}@{self.daemon_type}.{self.daemon_id}' + def data_dir(self, base_data_dir: Union[str, os.PathLike]) -> str: + return str(pathlib.Path(base_data_dir) / self.fsid / self.daemon_name) + @classmethod def from_name(cls, fsid: str, name: str) -> 'DaemonIdentity': daemon_type, daemon_id = name.split('.', 1)