MCPcopy Create free account
hub / github.com/aaPanel/BaoTa / remove_service

Method remove_service

mod/project/python/serviceMod.py:526–542  ·  view source on GitHub ↗
(self, sid: str)

Source from the content-addressed store, hash-verified

524 self.save_service_conf()
525
526 def remove_service(self, sid: str) -> Optional[str]:
527 del_idx = None
528 for idx, i in enumerate(self.other_services):
529 if i["sid"] == sid:
530 del_idx = idx
531 break
532
533 if del_idx is None:
534 return "未找到该服务"
535 del_conf = self.other_services.pop(del_idx)
536 self.save_service_conf()
537 log_file = os.path.join(SERVICE_PATH, '{}/{}.log'.format(self.project_name, del_conf["name"]))
538 pid_file = os.path.join(SERVICE_PATH, '{}/{}.pid'.format(self.project_name, del_conf["name"]))
539 if os.path.exists(log_file):
540 os.remove(log_file)
541 if os.path.exists(pid_file):
542 os.remove(pid_file)
543
544 def _get_service_conf_by_sid(self, sid: str) -> Optional[Dict]:
545 for i in self.service_list:

Callers

nothing calls this directly

Calls 6

save_service_confMethod · 0.95
popMethod · 0.45
joinMethod · 0.45
formatMethod · 0.45
existsMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected