From f4487acb476de36ee96630a1f9a8cea2165909a3 Mon Sep 17 00:00:00 2001 From: shoopea Date: Mon, 31 Jul 2023 10:46:02 +0200 Subject: [PATCH] taking wrong box for cleanup --- app.go | 24 ++++++++++++++---------- config.go | 8 ++++---- version.go | 8 ++++---- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/app.go b/app.go index 9d83bbd..fd3d1ab 100644 --- a/app.go +++ b/app.go @@ -173,8 +173,8 @@ func (a *App) Cleanup(now time.Time) error { } for _, dest := range a.destinations { if cfg.box[dest.Box()].online { - dest = dest.Append("/" + src.Box() + "/" + src.Path()) - for _, s := range cfg.box[dest.Box()].zfs.filesystems[dest.Path()].snapshots { + dest2 := dest.Append("/" + src.Box() + "/" + src.Path()) + for _, s := range cfg.box[dest2.Box()].zfs.filesystems[dest2.Path()].snapshots { if !s.Valid() { if err := s.Delete(); err != nil { log.WithFields(log.Fields{"app": a.name, "now": now, "box": src.Box(), "snapshot": s.String(), "call": "Delete", "error": err}).Errorf("") @@ -478,27 +478,31 @@ func (a *App) Transfer() error { defer log.WithFields(log.Fields{"app": a.name}).Debugf("done") for _, src := range a.sources { + backedUp := false for _, dest := range a.destinations { - dest := dest.Append("/" + src.Box() + "/" + src.Path()) - if dest.Online() { - if err := dest.Mkdir(); err != nil { + dest2 := dest.Append("/" + src.Box() + "/" + src.Path()) + if dest2.Online() { + if err := dest2.Mkdir(); err != nil { log.WithFields(log.Fields{"app": a.name, "call": "Mkdir", "attr": dest, "error": err}).Errorf("") return err } - if err := TransferZfs(src, dest); err != nil { + if err := TransferZfs(src, dest2); err != nil { log.WithFields(log.Fields{"app": a.name, "call": "TransferZfs", "src": src, "dest": dest, "error": err}).Errorf("") return err } - if err := dest.SetManaged(true); err != nil { + if err := dest2.SetManaged(true); err != nil { log.WithFields(log.Fields{"app": a.name, "call": "SetManaged", "src": src, "dest": dest, "error": err}).Errorf("") return err } + backedUp = true } } - if err := src.SetBackedUp(true); err != nil { - log.WithFields(log.Fields{"app": a.name, "call": "SetBackedUp", "src": src, "error": err}).Errorf("") - return err + if backedUp { + if err := src.SetBackedUp(true); err != nil { + log.WithFields(log.Fields{"app": a.name, "call": "SetBackedUp", "src": src, "error": err}).Errorf("") + return err + } } } diff --git a/config.go b/config.go index 8ac9baf..eb16039 100644 --- a/config.go +++ b/config.go @@ -214,12 +214,12 @@ func (c *Config) Cleanup(e *Email) { } } for _, dest := range a.destinations { - if b, ok := c.box[src.Box()]; ok { - d := dest.Append("/" + src.Box() + "/" + src.Path()) - if fs, ok := b.zfs.filesystems[d.Path()]; ok { + if b, ok := c.box[dest.Box()]; ok { + dest2 := dest.Append("/" + src.Box() + "/" + src.Path()) + if fs, ok := b.zfs.filesystems[dest2.Path()]; ok { fs.destApps = append(fs.destApps, a) } else { - e.AddItem(fmt.Sprintf(" - Dest : No folder (%s)", d.String())) + e.AddItem(fmt.Sprintf(" - Dest : No folder (%s)", dest2.String())) } } } diff --git a/version.go b/version.go index 05dff2d..5e274ae 100644 --- a/version.go +++ b/version.go @@ -1,7 +1,7 @@ // Code generated by version.sh (@generated) DO NOT EDIT. package main -var githash = "1387868" +var githash = "88220d4" var branch = "v2" -var buildstamp = "2023-07-31_08:33:33" -var commits = "69" -var version = "1387868-b69 - 2023-07-31_08:33:33" +var buildstamp = "2023-07-31_08:45:31" +var commits = "70" +var version = "88220d4-b70 - 2023-07-31_08:45:31"