tarBin
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing

This commit is contained in:
Adam Štrauch 2022-07-23 00:36:57 +02:00
parent 8adbf84362
commit b15e85474e
Signed by: cx
GPG Key ID: 018304FFA8988F8D

View File

@ -20,6 +20,7 @@ const dateFormat = "20060102_150405"
const keySplitCharacter = ":" const keySplitCharacter = ":"
const metadataPrefix = "_metadata" const metadataPrefix = "_metadata"
const metadataKeyTemplate = metadataPrefix + "/%s" const metadataKeyTemplate = metadataPrefix + "/%s"
const tarBin = "/bin/tar"
// Snapshot contains metadata about a single snapshot // Snapshot contains metadata about a single snapshot
type Snapshot struct { type Snapshot struct {
@ -137,7 +138,7 @@ func (s *SnapshotProcessor) CreateSnapshot(appName string, labels []string) (str
return snapshot.KeyName(s.IndexLabel), fmt.Errorf("change working directory error: %v", err) return snapshot.KeyName(s.IndexLabel), fmt.Errorf("change working directory error: %v", err)
} }
err = exec.Command("/bin/tar", "-acf", tmpSnapshotArchivePath, "./").Run() err = exec.Command(tarBin, "-acf", tmpSnapshotArchivePath, "./").Run()
if err != nil { if err != nil {
return snapshot.KeyName(s.IndexLabel), fmt.Errorf("compression error: %v", err) return snapshot.KeyName(s.IndexLabel), fmt.Errorf("compression error: %v", err)
} }
@ -191,7 +192,7 @@ func (s *SnapshotProcessor) RestoreSnapshot(key string, newAppName string) error
return fmt.Errorf("getting the archive from S3 error: %v", err) return fmt.Errorf("getting the archive from S3 error: %v", err)
} }
err = exec.Command("/usr/bin/tar", "-axf", tmpSnapshotArchivePath).Run() err = exec.Command(tarBin, "-axf", tmpSnapshotArchivePath).Run()
if err != nil { if err != nil {
return fmt.Errorf("unarchiving error: %v", err) return fmt.Errorf("unarchiving error: %v", err)
} }