forked from Ivasoft/objectivefs-docker-volume
Fix create backup snapshot
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
4
main.go
4
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 (<current UTC time>)
|
||||
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")
|
||||
|
||||
Reference in New Issue
Block a user