Skip to content

Commit

Permalink
Merge pull request #480 from mlycore/fix-init
Browse files Browse the repository at this point in the history
feat: add Init before AddInstance while backing up
  • Loading branch information
mlycore authored Dec 15, 2023
2 parents 081b0bb + 8cb6480 commit 7600684
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pitr/agent/internal/handler/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ func Backup(ctx *fiber.Ctx) error {
return fmt.Errorf(efmt, in.Username, len(in.Password), in.DBName, err)
}

if err := pkg.OG.Init(in.DnBackupPath); err != nil {
return fmt.Errorf("init instance failed, err: %w", err)
}

// try to add backup instance
if err := pkg.OG.AddInstance(in.DnBackupPath, in.Instance); err != nil && !errors.Is(err, cons.InstanceAlreadyExist) {
return fmt.Errorf("add instance failed, err wrap: %w", err)
Expand Down

0 comments on commit 7600684

Please sign in to comment.