Documentation
¶
Overview ¶
Package doctor checks that the host, tools, cluster and services an Obol Stack needs are healthy, and says exactly how to fix what isn't. Checks are read-only; the few safe, idempotent repairs run only with --fix.
Index ¶
Constants ¶
View Source
const ( GroupHost = "Host" GroupTools = "Tools" GroupStack = "Stack" GroupServices = "Services" GroupTunnel = "Tunnel" GroupWallets = "Wallets" )
Check groups, in display order.
View Source
const ClusterCheckID = "cluster"
ClusterCheckID runs first; checks with NeedsCluster wait on its result.
Variables ¶
View Source
var Groups = []string{GroupHost, GroupTools, GroupStack, GroupServices, GroupTunnel, GroupWallets}
Groups in display order.
Functions ¶
This section is empty.
Types ¶
type Check ¶
type Check struct {
ID string
Group string
Title string
// NeedsCluster checks are skipped when the stack isn't reachable.
NeedsCluster bool
// Online checks reach the internet; --offline skips them.
Online bool
Run func(ctx context.Context, e *Env) Result
// Repair, when set, is a safe idempotent fix that --fix runs for results
// the check marked Fixable.
Repair func(ctx context.Context, e *Env) error
}
Check is one diagnostic.
type Env ¶
type Env struct {
Cfg *config.Config
// Run executes a host command and returns its stdout.
Run func(ctx context.Context, name string, args ...string) ([]byte, error)
// LookupHost resolves a hostname.
LookupHost func(ctx context.Context, host string) ([]string, error)
// Listen probes whether a local TCP address is free.
Listen func(addr string) error
// HTTP is used for local and public probes.
HTTP *http.Client
// FreeBytes reports free space on the filesystem holding path.
FreeBytes func(path string) (uint64, error)
// Offline: checks must not touch the internet (tunnel skips its probes).
Offline bool
// contains filtered or unexported fields
}
Env is everything a check touches, so tests can fake it.
type Repairs ¶
type Repairs struct {
InstallTools func(ctx context.Context, e *Env) error
RefreshKubeconfig func(ctx context.Context, e *Env) error
PopulateCABundle func(ctx context.Context, e *Env) error
}
Repairs are the safe, idempotent fixes --fix may run. Nil entries mean the check reports a command instead.
type Result ¶
type Result struct {
ID string `json:"id"`
Group string `json:"group"`
Title string `json:"title"`
Status Status `json:"status"`
Message string `json:"message"`
// Fix is the exact command (or step) that resolves a warn/fail.
Fix string `json:"fix,omitempty"`
// Fixable means `obol doctor --fix` can repair it; Fixed that it did.
Fixable bool `json:"fixable,omitempty"`
Fixed bool `json:"fixed,omitempty"`
}
Result is what a check found.
Click to show internal directories.
Click to hide internal directories.