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

Method query

src/ceph-node-proxy/ceph_node_proxy/redfish.py:114–133  ·  view source on GitHub ↗
(self, url: str)

Source from the content-addressed store, hash-verified

112 return list(self._children.keys())
113
114 def query(self, url: str) -> Dict[str, Any]:
115 data: Dict[str, Any] = {}
116 try:
117 self.log.debug(f"Querying {url}")
118 _, _data, _ = self.client.query(endpoint=url)
119 if not _data:
120 self.log.warning(f"Empty response from {url}")
121 else:
122 data = json.loads(_data)
123 except KeyError as e:
124 self.log.error(f"KeyError while querying {url}: {e}")
125 except HTTPError as e:
126 self.log.error(f"HTTP error while querying {url} - {e.code} - {e.reason}")
127 except json.JSONDecodeError as e:
128 self.log.error(f"JSON decode error while querying {url}: {e}")
129 except Exception as e:
130 self.log.error(
131 f"Unexpected error while querying {url}: {type(e).__name__}: {e}"
132 )
133 return data
134
135 def get_data(self) -> Dict[str, Any]:
136 return self.query(self.url)

Callers 9

get_dataMethod · 0.95
get_members_dataMethod · 0.95
get_device_ledMethod · 0.45
set_device_ledMethod · 0.45
get_chassis_ledMethod · 0.45
set_chassis_ledMethod · 0.45
create_reboot_jobMethod · 0.45
schedule_reboot_jobMethod · 0.45
initMethod · 0.45

Calls 4

typeEnum · 0.50
debugMethod · 0.45
warningMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected