taking wrong box for cleanup

This commit is contained in:
shoopea 2023-07-31 10:46:02 +02:00
parent 88220d47e6
commit f4487acb47
3 changed files with 22 additions and 18 deletions

18
app.go
View File

@ -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,28 +478,32 @@ 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 backedUp {
if err := src.SetBackedUp(true); err != nil {
log.WithFields(log.Fields{"app": a.name, "call": "SetBackedUp", "src": src, "error": err}).Errorf("")
return err
}
}
}

View File

@ -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()))
}
}
}

View File

@ -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"