|
@@ -418,7 +418,6 @@ func (s *Server) runApplyTask(taskID string, input model.InterfaceConfig, manage
|
|
|
s.log.Error("netplan apply failed, restoring netplan file", "task_id", taskID, "file", filePath, "error", err.Error())
|
|
s.log.Error("netplan apply failed, restoring netplan file", "task_id", taskID, "file", filePath, "error", err.Error())
|
|
|
_ = s.netplanSvc.Restore(filePath, backupPath)
|
|
_ = s.netplanSvc.Restore(filePath, backupPath)
|
|
|
_ = s.applySvc.Apply()
|
|
_ = s.applySvc.Apply()
|
|
|
- _ = s.interfaceSvc.EnsureMaintenanceAddress()
|
|
|
|
|
s.logNetplanFile(taskID, filePath, "netplan restored after apply failure")
|
|
s.logNetplanFile(taskID, filePath, "netplan restored after apply failure")
|
|
|
s.taskSvc.Update(taskID, "rolled_back", "rolling_back", fmt.Sprintf("应用 netplan 失败,已自动回滚:%v", err), true)
|
|
s.taskSvc.Update(taskID, "rolled_back", "rolling_back", fmt.Sprintf("应用 netplan 失败,已自动回滚:%v", err), true)
|
|
|
return
|
|
return
|
|
@@ -476,7 +475,6 @@ func (s *Server) runApplyAllTask(taskID string, inputs []model.InterfaceConfig,
|
|
|
s.log.Error("netplan apply failed, restoring netplan file", "task_id", taskID, "file", filePath, "error", err.Error())
|
|
s.log.Error("netplan apply failed, restoring netplan file", "task_id", taskID, "file", filePath, "error", err.Error())
|
|
|
_ = s.netplanSvc.Restore(filePath, backupPath)
|
|
_ = s.netplanSvc.Restore(filePath, backupPath)
|
|
|
_ = s.applySvc.Apply()
|
|
_ = s.applySvc.Apply()
|
|
|
- _ = s.interfaceSvc.EnsureMaintenanceAddress()
|
|
|
|
|
s.logNetplanFile(taskID, filePath, "netplan restored after apply failure")
|
|
s.logNetplanFile(taskID, filePath, "netplan restored after apply failure")
|
|
|
s.taskSvc.Update(taskID, "rolled_back", "rolling_back", fmt.Sprintf("应用 netplan 失败,已自动回滚:%v", err), true)
|
|
s.taskSvc.Update(taskID, "rolled_back", "rolling_back", fmt.Sprintf("应用 netplan 失败,已自动回滚:%v", err), true)
|
|
|
return
|
|
return
|
|
@@ -598,7 +596,6 @@ func (s *Server) rollbackAppliedConfig(taskID string, filePath string, backupPat
|
|
|
s.log.Warn("apply confirmation failed, restoring netplan file", "task_id", taskID, "file", filePath, "reason", reason)
|
|
s.log.Warn("apply confirmation failed, restoring netplan file", "task_id", taskID, "file", filePath, "reason", reason)
|
|
|
_ = s.netplanSvc.Restore(filePath, backupPath)
|
|
_ = s.netplanSvc.Restore(filePath, backupPath)
|
|
|
_ = s.applySvc.Apply()
|
|
_ = s.applySvc.Apply()
|
|
|
- _ = s.interfaceSvc.EnsureMaintenanceAddress()
|
|
|
|
|
s.logNetplanFile(taskID, filePath, "netplan restored after confirmation failure")
|
|
s.logNetplanFile(taskID, filePath, "netplan restored after confirmation failure")
|
|
|
s.taskSvc.Update(taskID, "rolled_back", "rolling_back", fmt.Sprintf("%s,已自动回滚。", reason), true)
|
|
s.taskSvc.Update(taskID, "rolled_back", "rolling_back", fmt.Sprintf("%s,已自动回滚。", reason), true)
|
|
|
}
|
|
}
|