From 88220d47e67e1750578a2bd520075718f5faf47c Mon Sep 17 00:00:00 2001 From: shoopea Date: Mon, 31 Jul 2023 10:34:14 +0200 Subject: [PATCH] crash fix for offline boxes --- app.go | 28 +++++++++++++++------------- version.go | 8 ++++---- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/app.go b/app.go index 5e3d67d..9d83bbd 100644 --- a/app.go +++ b/app.go @@ -172,20 +172,22 @@ func (a *App) Cleanup(now time.Time) error { } } for _, dest := range a.destinations { - dest = dest.Append("/" + src.Box() + "/" + src.Path()) - for _, s := range cfg.box[dest.Box()].zfs.filesystems[dest.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("") - return err - } - } else if expired, err := s.Expired(now); err != nil { - log.WithFields(log.Fields{"app": a.name, "now": now, "box": dest.Box(), "snapshot": s.String(), "call": "Expired", "error": err}).Errorf("") - return err - } else if expired { - 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("") + 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 { + 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("") + return err + } + } else if expired, err := s.Expired(now); err != nil { + log.WithFields(log.Fields{"app": a.name, "now": now, "box": dest.Box(), "snapshot": s.String(), "call": "Expired", "error": err}).Errorf("") return err + } else if expired { + 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("") + return err + } } } } diff --git a/version.go b/version.go index 69623a0..05dff2d 100644 --- a/version.go +++ b/version.go @@ -1,7 +1,7 @@ // Code generated by version.sh (@generated) DO NOT EDIT. package main -var githash = "2afd699" +var githash = "1387868" var branch = "v2" -var buildstamp = "2023-07-31_08:29:23" -var commits = "68" -var version = "2afd699-b68 - 2023-07-31_08:29:23" +var buildstamp = "2023-07-31_08:33:33" +var commits = "69" +var version = "1387868-b69 - 2023-07-31_08:33:33"