From 25473265608a5e86ee5e61674cdc5d884b14249c Mon Sep 17 00:00:00 2001 From: artaasadi Date: Thu, 9 Jan 2025 20:50:14 +0100 Subject: [PATCH] fix: validate compliance jobs before running --- services/scheduler/schedulers/compliance/scheduler.go | 2 +- services/scheduler/server.go | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/services/scheduler/schedulers/compliance/scheduler.go b/services/scheduler/schedulers/compliance/scheduler.go index 1f7f92443..f8da685c4 100644 --- a/services/scheduler/schedulers/compliance/scheduler.go +++ b/services/scheduler/schedulers/compliance/scheduler.go @@ -17,7 +17,7 @@ func (s *JobScheduler) runScheduler() error { } clientCtx := &httpclient.Context{UserRole: api.AdminRole} - benchmarks, err := s.complianceClient.ListBenchmarks(clientCtx, nil) + benchmarks, err := s.complianceClient.ListBenchmarks(clientCtx, nil,nil) if err != nil { s.logger.Error("error while listing benchmarks", zap.Error(err)) return fmt.Errorf("error while listing benchmarks: %v", err) diff --git a/services/scheduler/server.go b/services/scheduler/server.go index f1b794cc9..3f5f0191f 100644 --- a/services/scheduler/server.go +++ b/services/scheduler/server.go @@ -135,7 +135,7 @@ func (h HttpServer) ListJobs(ctx echo.Context) error { return err } - benchmarks, err := h.Scheduler.complianceClient.ListBenchmarks(&httpclient.Context{UserRole: apiAuth.AdminRole}, nil) + benchmarks, err := h.Scheduler.complianceClient.ListBenchmarks(&httpclient.Context{UserRole: apiAuth.AdminRole}, nil, nil) if err != nil { return err } @@ -543,7 +543,7 @@ func (h HttpServer) TriggerConnectionsComplianceJobs(ctx echo.Context) error { var benchmarks []complianceapi.Benchmark var err error if len(benchmarkIDs) == 0 { - benchmarks, err = h.Scheduler.complianceClient.ListBenchmarks(clientCtx, nil) + benchmarks, err = h.Scheduler.complianceClient.ListBenchmarks(clientCtx, nil, nil) if err != nil { return fmt.Errorf("error while getting benchmarks: %v", err) } @@ -596,7 +596,7 @@ func (h HttpServer) TriggerConnectionsComplianceJobSummary(ctx echo.Context) err var benchmarks []complianceapi.Benchmark var err error if benchmarkID == "all" { - benchmarks, err = h.Scheduler.complianceClient.ListBenchmarks(clientCtx, nil) + benchmarks, err = h.Scheduler.complianceClient.ListBenchmarks(clientCtx, nil, nil) if err != nil { return fmt.Errorf("error while getting benchmarks: %v", err) } @@ -1400,7 +1400,7 @@ func (h HttpServer) RunBenchmark(ctx echo.Context) error { var benchmarks []complianceapi.Benchmark if len(request.BenchmarkIds) == 0 { - benchmarks, err = h.Scheduler.complianceClient.ListBenchmarks(clientCtx, nil) + benchmarks, err = h.Scheduler.complianceClient.ListBenchmarks(clientCtx, nil, nil) if err != nil { return fmt.Errorf("error while getting benchmarks: %v", err) } @@ -1956,7 +1956,7 @@ func (h HttpServer) ListComplianceJobs(ctx echo.Context) error { if err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) } - benchmarks, err := h.Scheduler.complianceClient.ListBenchmarks(&httpclient.Context{UserRole: apiAuth.AdminRole}, nil) + benchmarks, err := h.Scheduler.complianceClient.ListBenchmarks(&httpclient.Context{UserRole: apiAuth.AdminRole}, nil, nil) if err != nil { return err }