Skip to content

Commit

Permalink
fix: 快照前清空服务器地址 (#4068)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssongliu authored Mar 5, 2024
1 parent ab11d72 commit 5633bdd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion backend/app/service/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (u *SnapshotService) SnapshotImport(req dto.SnapshotImport) error {
for _, snap := range req.Names {
shortName := strings.TrimPrefix(snap, "snapshot_")
nameItems := strings.Split(shortName, "_")
if !strings.HasPrefix(shortName, "1panel_v") || !strings.HasSuffix(shortName, ".tar.gz") || len(nameItems) != 3 {
if !strings.HasPrefix(shortName, "1panel_v") || !strings.HasSuffix(shortName, ".tar.gz") || len(nameItems) < 3 {
return fmt.Errorf("incorrect snapshot name format of %s", shortName)
}
if strings.HasSuffix(snap, ".tar.gz") {
Expand Down
3 changes: 3 additions & 0 deletions backend/app/service/snapshot_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ func snapPanelData(snap snapHelper, localDir, targetDir string) {
}

_ = snapshotRepo.Update(snap.SnapID, map[string]interface{}{"status": "OnSaveData"})
sysIP, _ := settingRepo.Get(settingRepo.WithByKey("SystemIP"))
_ = settingRepo.Update("SystemIP", "")
checkPointOfWal()
if err := handleSnapTar(dataDir, targetDir, "1panel_data.tar.gz", exclusionRules); err != nil {
status = err.Error()
Expand All @@ -148,6 +150,7 @@ func snapPanelData(snap snapHelper, localDir, targetDir string) {

snap.Status.PanelData = status
_ = snapshotRepo.UpdateStatus(snap.Status.ID, map[string]interface{}{"panel_data": status})
_ = settingRepo.Update("SystemIP", sysIP.Value)
}

func snapCompress(snap snapHelper, rootDir string) {
Expand Down
1 change: 1 addition & 0 deletions backend/router/ro_dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func (s *DashboardRouter) InitRouter(Router *gin.RouterGroup) {
Use(middleware.PasswordExpired())
baseApi := v1.ApiGroupApp.BaseApi
{
cmdRouter.GET("/base/os", baseApi.LoadDashboardOsInfo)
cmdRouter.GET("/base/:ioOption/:netOption", baseApi.LoadDashboardBaseInfo)
cmdRouter.GET("/current/:ioOption/:netOption", baseApi.LoadDashboardCurrentInfo)
cmdRouter.POST("/system/restart/:operation", baseApi.SystemRestart)
Expand Down

0 comments on commit 5633bdd

Please sign in to comment.