@@ -91,7 +91,7 @@ func integrityChecks(ctx context.Context, rootDir string) error {
91
91
// runChecks starts provisiond with the special flag `--integrity` which runs some
92
92
// checks and return an error if checks did not pass.
93
93
// if an error is received the db files are cleaned
94
- func runChecks (ctx context.Context , rootDir string ) error {
94
+ func runChecks (ctx context.Context , rootDir string , cl zbus. Client ) error {
95
95
log .Info ().Msg ("run integrity checks" )
96
96
ctx , cancel := context .WithTimeout (ctx , 30 * time .Second )
97
97
defer cancel ()
@@ -110,6 +110,13 @@ func runChecks(ctx context.Context, rootDir string) error {
110
110
111
111
log .Error ().Str ("stderr" , buf .String ()).Err (err ).Msg ("integrity check failed, resetting rrd db" )
112
112
113
+ zui := stubs .NewZUIStub (cl )
114
+ if er := zui .PushErrors (ctx , "integrity" , []string {
115
+ fmt .Sprintf ("integrity check failed, resetting rrd db stderr=%s: %v" , buf .String (), err ),
116
+ }); er != nil {
117
+ log .Error ().Err (er ).Msg ("failed to push errors to zui" )
118
+ }
119
+
113
120
// other error, we can try to clean up and continue
114
121
return os .RemoveAll (filepath .Join (rootDir , metricsStorageDB ))
115
122
}
@@ -121,6 +128,14 @@ func action(cli *cli.Context) error {
121
128
integrity bool = cli .Bool ("integrity" )
122
129
)
123
130
131
+ server , err := zbus .NewRedisServer (serverName , msgBrokerCon , 1 )
132
+ if err != nil {
133
+ return errors .Wrap (err , "failed to connect to message broker" )
134
+ }
135
+ cl , err := zbus .NewRedisClient (msgBrokerCon )
136
+ if err != nil {
137
+ return errors .Wrap (err , "fail to connect to message broker server" )
138
+ }
124
139
ctx , _ := utils .WithSignal (context .Background ())
125
140
126
141
if integrity {
@@ -132,7 +147,7 @@ func action(cli *cli.Context) error {
132
147
})
133
148
134
149
// run integrityChecks
135
- if err := runChecks (ctx , rootDir ); err != nil {
150
+ if err := runChecks (ctx , rootDir , cl ); err != nil {
136
151
return errors .Wrap (err , "error running integrity checks" )
137
152
}
138
153
@@ -160,15 +175,6 @@ func action(cli *cli.Context) error {
160
175
select {}
161
176
}
162
177
163
- server , err := zbus .NewRedisServer (serverName , msgBrokerCon , 1 )
164
- if err != nil {
165
- return errors .Wrap (err , "failed to connect to message broker" )
166
- }
167
- cl , err := zbus .NewRedisClient (msgBrokerCon )
168
- if err != nil {
169
- return errors .Wrap (err , "fail to connect to message broker server" )
170
- }
171
-
172
178
identity := stubs .NewIdentityManagerStub (cl )
173
179
sk := ed25519 .PrivateKey (identity .PrivateKey (ctx ))
174
180
0 commit comments