def delete(self, request, *args, **kwargs): """ 删除组件标签 --- parameters: - name: tenantName description: 租户名 required: true type: string paramType: path - name: serviceAlias description: 组件别名 required: true type: string paramType: path - name: label_id description: 组件标签 id required: true type: string paramType: form """ label_id = request.data.get("label_id", None) if not label_id: return Response(general_message(400, "param error", "标签ID未指定"), status=400) service_label = service_label_repo.get_service_label(self.service.service_id, label_id) if not service_label: return Response(general_message(400, "tag does not exist", "标签不存在"), status=400) code, msg, event = label_service.delete_service_label(self.tenant, self.service, label_id, self.user.nick_name) if code != 200: return Response(general_message(code, "add labels error", msg), status=code) result = general_message(200, "success", "标签删除成功") return Response(result, status=result["code"])
def get_service_os_name(self, service): os_label = label_repo.get_labels_by_label_name("windows") if os_label: if service_label_repo.get_service_label(service.service_id, os_label.label_id): return "windows" return "linux"