/
checks.go
79 lines (75 loc) · 1.4 KB
/
checks.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package doctor
import (
"github.com/ksync/ksync/pkg/cli"
)
// Check provides the definition of check that is named and validates something.
type Check struct {
Name string
Func func() error
Type string
}
// CheckList is the full list of checks run by doctor.
var CheckList = []Check{
Check{
Name: "Extra Binaries",
Func: DoesSyncthingExist,
},
Check{
Name: "Cluster Config",
Func: IsClusterConfigValid,
Type: "pre",
},
Check{
Name: "Cluster Connection",
Func: CanConnectToCluster,
Type: "pre",
},
Check{
Name: "Cluster Version",
Func: IsClusterVersionSupported,
Type: "pre",
},
Check{
Name: "Cluster Permissions",
Func: HasClusterPermissions,
Type: "pre",
},
Check{
Name: "Cluster Service",
Func: HasClusterService,
Type: "post",
},
Check{
Name: "Service Health",
Func: IsClusterServiceHealthy,
Type: "post",
},
Check{
Name: "Service Version",
Func: IsServiceCompatible,
Type: "post",
},
Check{
Name: "Docker Version",
Func: IsDockerVersionCompatible,
Type: "post",
},
Check{
Name: "Docker Storage Driver",
Func: IsDockerStorageCompatible,
Type: "post",
},
Check{
Name: "Docker Storage Root",
Func: IsDockerGraphMatching,
Type: "post",
},
Check{
Name: "Watch Running",
Func: IsWatchRunning,
},
}
// Out provides pretty output with colors and spinners of progress.
func (c *Check) Out() error {
return cli.TaskOut(c.Name, c.Func)
}