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

Function get_component_data

src/ceph-node-proxy/ceph_node_proxy/redfish.py:277–306  ·  view source on GitHub ↗

Build component data from Redfish endpoints. Returns dict sys_id -> member_id -> data.

(
    endpoints: EndpointMgr,
    collection: str,
    path: str,
    fields: List[str],
    log: Any,
    attribute: Optional[str] = None,
)

Source from the content-addressed store, hash-verified

275
276
277def get_component_data(
278 endpoints: EndpointMgr,
279 collection: str,
280 path: str,
281 fields: List[str],
282 log: Any,
283 attribute: Optional[str] = None,
284) -> Dict[str, Any]:
285 """Build component data from Redfish endpoints. Returns dict sys_id -> member_id -> data."""
286 members: List[str] = endpoints[collection].get_members_names()
287 result: Dict[str, Any] = {}
288 if not members:
289 ep = _resolve_path(endpoints[collection], path)
290 data = ep.get_members_data()
291 result = build_data(data=data, fields=fields, log=log, attribute=attribute)
292 else:
293 for member in members:
294 try:
295 ep = _resolve_path(endpoints[collection][member], path)
296 if attribute is None:
297 data = ep.get_members_data()
298 else:
299 data = ep.data
300 result[member] = build_data(
301 data=data, fields=fields, log=log, attribute=attribute
302 )
303 except HTTPError as e:
304 log.error(f"Error while updating {path}: {e}")
305 continue
306 return result
307
308
309def update_component(

Callers 2

_run_updateMethod · 0.90
update_componentFunction · 0.85

Calls 5

_resolve_pathFunction · 0.85
build_dataFunction · 0.85
get_members_namesMethod · 0.80
get_members_dataMethod · 0.80
errorMethod · 0.45

Tested by

no test coverage detected