]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: add python hints to util.prepare.create_id() 61252/head
authorGuillaume Abrioux <gabrioux@ibm.com>
Tue, 7 Jan 2025 09:22:00 +0000 (09:22 +0000)
committerGuillaume Abrioux <gabrioux@ibm.com>
Tue, 7 Jan 2025 09:22:00 +0000 (09:22 +0000)
This commit introduces type annotations to the `create_id` function in `ceph_volume.util.prepare`.
The parameters and return value are now typed as follows:
  - `fsid` is a `str`.
  - `json_secrets` is a `str`.
  - `osd_id` is an optional `str` (`Optional[str]`).
  - The function returns a `str`.

Signed-off-by: Guillaume Abrioux <gabrioux@ibm.com>
src/ceph-volume/ceph_volume/util/prepare.py

index 9c863b83d938f52ba044b8693569b64f3c8dc1b0..ff7fc023fc493287fe585e13f0bafd6872cac288 100644 (file)
@@ -9,6 +9,7 @@ import logging
 import json
 from ceph_volume import process, conf, terminal
 from ceph_volume.util import system, constants, str_to_int, disk
+from typing import Optional
 
 logger = logging.getLogger(__name__)
 mlogger = terminal.MultiLogger(__name__)
@@ -121,7 +122,7 @@ def get_block_wal_size(lv_format=True):
     return wal_size
 
 
-def create_id(fsid, json_secrets, osd_id=None):
+def create_id(fsid: str, json_secrets: str, osd_id: Optional[str]=None) -> str:
     """
     :param fsid: The osd fsid to create, always required
     :param json_secrets: a json-ready object with whatever secrets are wanted