MCPcopy Create free account
hub / github.com/ceph/ceph / load_cephadm_config

Function load_cephadm_config

src/ceph-node-proxy/ceph_node_proxy/config.py:56–70  ·  view source on GitHub ↗

Load and validate cephadm bootstrap config from a JSON file. Raises FileNotFoundError if path does not exist, ValueError if invalid.

(path: str)

Source from the content-addressed store, hash-verified

54
55
56def load_cephadm_config(path: str) -> CephadmConfig:
57 """
58 Load and validate cephadm bootstrap config from a JSON file.
59 Raises FileNotFoundError if path does not exist, ValueError if invalid.
60 """
61 if not os.path.exists(path):
62 raise FileNotFoundError(f"Config file not found: {path}")
63 with open(path, "r") as f:
64 try:
65 data = json.load(f)
66 except json.JSONDecodeError as e:
67 raise ValueError(f"Invalid JSON config: {e}") from e
68 if not isinstance(data, dict):
69 raise ValueError("Config must be a JSON object")
70 return CephadmConfig.from_dict(data)
71
72
73def get_node_proxy_config(

Callers 1

mainFunction · 0.90

Calls 3

existsMethod · 0.45
loadMethod · 0.45
from_dictMethod · 0.45

Tested by

no test coverage detected