def get_log_data(self, logs, project_id, cluster_id): if not logs: return {'status': 'none'} data = { 'project_id': project_id, 'cluster_id': cluster_id, 'status': self.get_display_status(logs[0].status), 'log': [] } for info in logs: data['task_url'] = info.log_params.get('task_url') or '' info.status = self.get_display_status(info.status) slz = cluster_serializers.ClusterInstallLogSLZ(instance=info) data['log'].append(slz.data) return data
def get_log_data(self, logs, project_id, cluster_id): if not logs: return {"status": "none"} data = { "project_id": project_id, "cluster_id": cluster_id, "status": self.get_display_status(logs[0].status), "log": [], "task_url": logs.first().log_params.get("task_url") or "" } for info in logs: info.status = self.get_display_status(info.status) slz = cluster_serializers.ClusterInstallLogSLZ(instance=info) data["log"].append(slz.data) return data
def get_log_data(self, logs, project_id, cluster_id): if not logs: return {"status": "none"} # 获取最新的一条记录的状态 latest_log = logs[0] status = self.get_display_status(latest_log.status) data = { "project_id": project_id, "cluster_id": cluster_id, "status": status, "log": [], "task_url": logs.first().log_params.get("task_url") or "", "error_msg_list": [], } for info in logs: info.status = self.get_display_status(info.status) slz = cluster_serializers.ClusterInstallLogSLZ(instance=info) data["log"].append(slz.data) return data