In-place upgrade tool for Stalwart Mail Server (0.15.5 -> latest) with checkpointed rollback and post-migration validation. Design stage; see ARCHITECTURE.md.
37 lines
799 B
Go
37 lines
799 B
Go
package backup
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
// Status is a single backup step's verdict. Unlike preflight, most backup
|
|
// steps that fail are hard failures (Run aborts) rather than advisory - see
|
|
// Run's doc comment - but Status still distinguishes "did the thing" from
|
|
// "correctly skipped because it doesn't apply to this deployment".
|
|
type Status string
|
|
|
|
const (
|
|
StatusOK Status = "ok"
|
|
StatusSkipped Status = "skipped"
|
|
StatusFail Status = "fail"
|
|
)
|
|
|
|
type CheckResult struct {
|
|
Name string
|
|
Status Status
|
|
Detail string
|
|
}
|
|
|
|
type Report struct {
|
|
Results []CheckResult
|
|
}
|
|
|
|
func (r Report) String() string {
|
|
var b strings.Builder
|
|
for _, res := range r.Results {
|
|
fmt.Fprintf(&b, "[%-7s] %-18s %s\n", strings.ToUpper(string(res.Status)), res.Name, res.Detail)
|
|
}
|
|
return b.String()
|
|
}
|