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

Method run

src/ceph-node-proxy/ceph_node_proxy/api.py:274–310  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

272 self.cp_shutdown_event.set()
273
274 def run(self) -> None:
275 self.log.info("node-proxy API configuration...")
276 cherrypy.config.update(
277 {
278 "environment": "production",
279 "engine.autoreload.on": False,
280 "log.screen": True,
281 }
282 )
283 config = {
284 "/": {
285 "request.methods_with_bodies": ("POST", "PUT", "PATCH"),
286 "tools.trailing_slash.on": False,
287 "tools.auth_basic.realm": "localhost",
288 "tools.auth_basic.checkpassword": self.check_auth,
289 }
290 }
291 cherrypy.tree.mount(self.api, "/", config=config)
292 # cherrypy.tree.mount(admin, '/admin', config=config)
293
294 ssl_crt = write_tmp_file(self.ssl_crt, prefix_name="listener-crt-")
295 ssl_key = write_tmp_file(self.ssl_key, prefix_name="listener-key-")
296
297 self.api.ssl_certificate = ssl_crt.name
298 self.api.ssl_private_key = ssl_key.name
299
300 cherrypy.server.unsubscribe()
301 try:
302 cherrypy.engine.start()
303 self.log.info("node-proxy API started.")
304 self.cp_shutdown_event.wait()
305 self.cp_shutdown_event.clear()
306 cherrypy.engine.exit()
307 cherrypy.server.httpserver = None
308 self.log.info("node-proxy API shutdown.")
309 except Exception as e:
310 self.log.error(f"node-proxy API error: {e}")

Callers 1

startMethod · 0.45

Calls 10

write_tmp_fileFunction · 0.90
unsubscribeMethod · 0.80
infoMethod · 0.45
updateMethod · 0.45
mountMethod · 0.45
startMethod · 0.45
waitMethod · 0.45
clearMethod · 0.45
exitMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected