Skip to content

Commit 7463e60

Browse files
Eslam-Nawaraashraffouda
authored andcommitted
clean up zui errors segment for integrity
1 parent ca68a36 commit 7463e60

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

cmds/modules/provisiond/main.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ var Module cli.Command = cli.Command{
8181
// state
8282
func integrityChecks(ctx context.Context, rootDir string) error {
8383
err := ReportChecks(filepath.Join(rootDir, metricsStorageDB))
84-
8584
if err != nil {
8685
fmt.Fprintln(os.Stderr, err)
8786
}
@@ -101,6 +100,12 @@ func runChecks(ctx context.Context, rootDir string, cl zbus.Client) error {
101100
var buf bytes.Buffer
102101
cmd.Stderr = &buf
103102

103+
zui := stubs.NewZUIStub(cl)
104+
// empty out zui errors for powerd
105+
if zuiErr := zui.PushErrors(ctx, "integrity", []string{}); zuiErr != nil {
106+
log.Info().Err(zuiErr).Send()
107+
}
108+
104109
cmd.CombinedOutput()
105110
err := cmd.Run()
106111
if err == context.Canceled {
@@ -111,7 +116,6 @@ func runChecks(ctx context.Context, rootDir string, cl zbus.Client) error {
111116

112117
log.Error().Str("stderr", buf.String()).Err(err).Msg("integrity check failed, resetting rrd db")
113118

114-
zui := stubs.NewZUIStub(cl)
115119
if er := zui.PushErrors(ctx, "integrity", []string{
116120
fmt.Sprintf("integrity check failed, resetting rrd db stderr=%s: %v", buf.String(), err),
117121
}); er != nil {
@@ -198,7 +202,7 @@ func action(cli *cli.Context) error {
198202

199203
// the v1 endpoint will be used by all components to register endpoints
200204
// that are specific for that component
201-
//v1 := router.PathPrefix("/api/v1").Subrouter()
205+
// v1 := router.PathPrefix("/api/v1").Subrouter()
202206
// keep track of resource units reserved and amount of workloads provisionned
203207

204208
// to store reservation locally on the node
@@ -330,7 +334,7 @@ func action(cli *cli.Context) error {
330334
zos.PublicIPv4Type,
331335
zos.PublicIPType,
332336
zos.ZMachineType,
333-
zos.ZLogsType, //make sure zlogs comes after zmachine
337+
zos.ZLogsType, // make sure zlogs comes after zmachine
334338
),
335339
// if this is a node reboot, the node needs to
336340
// recreate all reservations. so we set rerun = true
@@ -340,7 +344,6 @@ func action(cli *cli.Context) error {
340344
// capacity on chain.
341345
provision.WithCallback(setter.Callback),
342346
)
343-
344347
if err != nil {
345348
return errors.Wrap(err, "failed to instantiate provision engine")
346349
}

0 commit comments

Comments
 (0)