fix crash for new app with no dest path existing

This commit is contained in:
shoopea 2023-07-01 22:34:04 +02:00
parent e07c1c4f3f
commit 24a5e6676f
2 changed files with 11 additions and 9 deletions

12
app.go
View File

@ -230,11 +230,13 @@ func (a *App) SanityCheck() error {
onlineDestinations++ onlineDestinations++
for _, src := range a.sources { for _, src := range a.sources {
dest2 := dest.Append("/" + src.Box() + "/" + src.Path()) dest2 := dest.Append("/" + src.Box() + "/" + src.Path())
for _, s := range b.zfs.filesystems[dest2.Path()].snapshots { if fs, ok := b.zfs.filesystems[dest2.Path()]; ok {
if !s.Valid() { for _, s := range fs.snapshots {
if err := s.Delete(); err != nil { if !s.Valid() {
log.WithFields(log.Fields{"app": a.name, "box": src.Box(), "snapshot": s.String(), "call": "Delete", "error": err}).Errorf("") if err := s.Delete(); err != nil {
return err log.WithFields(log.Fields{"app": a.name, "box": src.Box(), "snapshot": s.String(), "call": "Delete", "error": err}).Errorf("")
return err
}
} }
} }
} }

View File

@ -1,7 +1,7 @@
// Code generated by version.sh (@generated) DO NOT EDIT. // Code generated by version.sh (@generated) DO NOT EDIT.
package main package main
var githash = "db05789" var githash = "e07c1c4"
var branch = "v2" var branch = "v2"
var buildstamp = "2023-07-01_12:10:14" var buildstamp = "2023-07-01_20:33:58"
var commits = "64" var commits = "65"
var version = "db05789-b64 - 2023-07-01_12:10:14" var version = "e07c1c4-b65 - 2023-07-01_20:33:58"