doctor: surface state store open failure as failing check
Previously store.Open errors were silently swallowed, so `banger doctor` could report green while the default-image check (and any other store-dependent diagnostic) was silently skipped because d.store was nil. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
3f6ecb4376
commit
d38f580e00
1 changed files with 14 additions and 4 deletions
|
|
@ -27,17 +27,27 @@ func Doctor(ctx context.Context) (system.Report, error) {
|
||||||
config: cfg,
|
config: cfg,
|
||||||
runner: system.NewRunner(),
|
runner: system.NewRunner(),
|
||||||
}
|
}
|
||||||
db, err := store.Open(layout.DBPath)
|
db, storeErr := store.Open(layout.DBPath)
|
||||||
if err == nil {
|
if storeErr == nil {
|
||||||
defer db.Close()
|
defer db.Close()
|
||||||
d.store = db
|
d.store = db
|
||||||
}
|
}
|
||||||
return d.doctorReport(ctx), nil
|
return d.doctorReport(ctx, storeErr), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Daemon) doctorReport(ctx context.Context) system.Report {
|
func (d *Daemon) doctorReport(ctx context.Context, storeErr error) system.Report {
|
||||||
report := system.Report{}
|
report := system.Report{}
|
||||||
|
|
||||||
|
if storeErr != nil {
|
||||||
|
report.AddFail(
|
||||||
|
"state store",
|
||||||
|
fmt.Sprintf("open %s: %v", d.layout.DBPath, storeErr),
|
||||||
|
"remove or restore the file if corrupt; otherwise check its permissions",
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
report.AddPass("state store", "readable at "+d.layout.DBPath)
|
||||||
|
}
|
||||||
|
|
||||||
report.AddPreflight("host runtime", d.runtimeChecks(), runtimeStatus(d.config))
|
report.AddPreflight("host runtime", d.runtimeChecks(), runtimeStatus(d.config))
|
||||||
report.AddPreflight("core vm lifecycle", d.coreVMLifecycleChecks(), "required host tools available")
|
report.AddPreflight("core vm lifecycle", d.coreVMLifecycleChecks(), "required host tools available")
|
||||||
report.AddPreflight("vsock guest agent", d.vsockChecks(), "vsock guest agent prerequisites available")
|
report.AddPreflight("vsock guest agent", d.vsockChecks(), "vsock guest agent prerequisites available")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue