Skip to content

Commit

Permalink
internal/recover: Return recovery tarball path
Browse files Browse the repository at this point in the history
Signed-off-by: Wesley Hershberger <[email protected]>
  • Loading branch information
MggMuggins committed Jun 25, 2024
1 parent fd26698 commit 94c91a5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions internal/recover/recover.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,12 @@ func ValidateMemberChanges(oldMembers []cluster.LocalMember, newMembers []cluste
// CreateRecoveryTarball writes a tarball of filesystem.DatabaseDir to
// filesystem.StateDir.
// go-dqlite's info.yaml is excluded from the tarball.
func CreateRecoveryTarball(filesystem *sys.OS) error {
// This function returns the path to the tarball.
func CreateRecoveryTarball(filesystem *sys.OS) (string, error) {
dbFS := os.DirFS(filesystem.DatabaseDir)
dbFiles, err := fs.Glob(dbFS, "*")
if err != nil {
return fmt.Errorf("%w", err)
return "", fmt.Errorf("%w", err)
}

tarballPath := path.Join(filesystem.StateDir, "recovery_db.tar.gz")
Expand All @@ -130,7 +131,7 @@ func CreateRecoveryTarball(filesystem *sys.OS) error {
}
}

return createTarball(tarballPath, filesystem.DatabaseDir, dbFiles)
return tarballPath, createTarball(tarballPath, filesystem.DatabaseDir, dbFiles)
}

// MaybeUnpackRecoveryTarball checks for the presence of a recovery tarball in
Expand Down

0 comments on commit 94c91a5

Please sign in to comment.