test email and clean first snapshots

This commit is contained in:
shoopea
2022-06-17 20:54:14 +08:00
parent 41d56eb90a
commit e62627e406
5 changed files with 88 additions and 18 deletions

View File

@@ -15,8 +15,9 @@ import (
type Config struct {
Zfsnap map[string]string `json:"zfsnap"`
Box map[string]*Box `json:"box"`
Apps []AppConfig `json:apps`
Apps []AppConfig `json:"apps"`
Timezone string `json:"timezone"`
Email EmailConfig `json:"email"`
Now time.Time `json:"-"`
}
@@ -135,7 +136,7 @@ func (c *Config) Load() error {
return fmt.Errorf("No box defined for source : %s", string(src))
}
if !cfg.Box[src.Box()].online {
return fmt.Errorf("Source box offline for app : %s", app.Name)
email.items = append(email.items, fmt.Sprintf("Source box offline for app : %s", app.Name))
}
}
var allOffline bool = true
@@ -151,7 +152,7 @@ func (c *Config) Load() error {
}
}
if allOffline {
return fmt.Errorf("No online destination box for app : %s", app.Name)
email.items = append(email.items, fmt.Sprintf("No online destination box for app : %s", app.Name))
}
for val, before := range app.Before {
@@ -169,7 +170,7 @@ func (c *Config) Load() error {
return fmt.Errorf("No box defined for before : %s", string(before))
}
if !cfg.Box[before.Box()].online {
return fmt.Errorf("Before box offline for app : %s", app.Name)
email.items = append(email.items, fmt.Sprintf("Before box offline for app : %s", app.Name))
}
}
for val, after := range app.After {
@@ -187,7 +188,7 @@ func (c *Config) Load() error {
return fmt.Errorf("No box defined for after : %s", string(after))
}
if !cfg.Box[after.Box()].online {
return fmt.Errorf("After box offline for app : %s", app.Name)
email.items = append(email.items, fmt.Sprintf("After box offline for app : %s", app.Name))
}
}
}