From 590a541e3fc3d1ddfb5a2ca2b1b45d47ab3c416f Mon Sep 17 00:00:00 2001 From: Roman Vanicek Date: Sun, 5 May 2024 01:36:38 +0200 Subject: [PATCH] Fix create backup snapshot --- main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 0b0df7f..2f1c760 100644 --- a/main.go +++ b/main.go @@ -307,12 +307,12 @@ func (d *ofsDriver) Mount(r *volume.MountRequest) (*volume.MountResponse, error) var fs string if v.Backup { log.WithFields(log.Fields{"name": r.Name}).Info("Going to create a backup snapshot") - if snapshotTextB, err := applyEnv(exec.Command("/sbin/mount.objectivefs", "snapshot", v.Fs), v.Env).CombinedOutput(); err == nil { + if snapshotTextB, err := applyEnv(exec.Command("/sbin/mount.objectivefs", "snapshot", v.Fs), v.Env).CombinedOutput(); err != nil { log.WithFields(log.Fields{"name": v.Volume.Name, "output": string(snapshotTextB[:])}).Info("Failed to create a new backup snapshot") return &volume.MountResponse{}, err } else { // Format: NOTE: Successfully created snapshot: snapshotId () - const okPrefix = "NOTE: Successfully created snapshot:" + const okPrefix = "NOTE: Successfully created snapshot: " snapshotText := string(snapshotTextB[:]) if snapshotIdWithSuffix, isOk := strings.CutPrefix(snapshotText, okPrefix); !isOk { log.WithFields(log.Fields{"name": v.Volume.Name, "snapshot": v.BackupSnapshot}).Info("Failed to create a new backup snapshot")