Browse Source

fix: 修改快照 json 文件生成逻辑 (#3993)

pull/4008/head
ssongliu 9 months ago committed by GitHub
parent
commit
121a1ff5da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 3
      backend/app/service/snapshot.go

3
backend/app/service/snapshot.go

@ -234,6 +234,7 @@ func (u *SnapshotService) SnapshotRecover(req dto.SnapshotRecover) error {
} }
isReTry = false isReTry = false
} }
_ = u.saveJson(snapJson, u.OriginalPath)
_, _ = cmd.Exec("systemctl stop docker") _, _ = cmd.Exec("systemctl stop docker")
if !isReTry || snap.InterruptStep == "DockerDir" { if !isReTry || snap.InterruptStep == "DockerDir" {
@ -244,6 +245,7 @@ func (u *SnapshotService) SnapshotRecover(req dto.SnapshotRecover) error {
isReTry = false isReTry = false
} }
} else { } else {
_ = u.saveJson(snapJson, u.OriginalPath)
if !isReTry || snap.InterruptStep == "DockerDir" { if !isReTry || snap.InterruptStep == "DockerDir" {
if err := u.handleDockerDatasWithSave(fileOp, operation, rootDir, ""); err != nil { if err := u.handleDockerDatasWithSave(fileOp, operation, rootDir, ""); err != nil {
updateRecoverStatus(snap.ID, "DockerDir", constant.StatusFailed, err.Error()) updateRecoverStatus(snap.ID, "DockerDir", constant.StatusFailed, err.Error())
@ -252,7 +254,6 @@ func (u *SnapshotService) SnapshotRecover(req dto.SnapshotRecover) error {
isReTry = false isReTry = false
} }
} }
_ = u.saveJson(snapJson, u.OriginalPath)
if !isReTry || snap.InterruptStep == "DaemonJson" { if !isReTry || snap.InterruptStep == "DaemonJson" {
if err := u.handleDaemonJson(fileOp, operation, rootDir+"/docker/daemon.json", u.OriginalPath); err != nil { if err := u.handleDaemonJson(fileOp, operation, rootDir+"/docker/daemon.json", u.OriginalPath); err != nil {

Loading…
Cancel
Save