fix crash for new app with no dest path existing
This commit is contained in:
12
app.go
12
app.go
@@ -230,11 +230,13 @@ func (a *App) SanityCheck() error {
|
||||
onlineDestinations++
|
||||
for _, src := range a.sources {
|
||||
dest2 := dest.Append("/" + src.Box() + "/" + src.Path())
|
||||
for _, s := range b.zfs.filesystems[dest2.Path()].snapshots {
|
||||
if !s.Valid() {
|
||||
if err := s.Delete(); err != nil {
|
||||
log.WithFields(log.Fields{"app": a.name, "box": src.Box(), "snapshot": s.String(), "call": "Delete", "error": err}).Errorf("")
|
||||
return err
|
||||
if fs, ok := b.zfs.filesystems[dest2.Path()]; ok {
|
||||
for _, s := range fs.snapshots {
|
||||
if !s.Valid() {
|
||||
if err := s.Delete(); err != nil {
|
||||
log.WithFields(log.Fields{"app": a.name, "box": src.Box(), "snapshot": s.String(), "call": "Delete", "error": err}).Errorf("")
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user