Skip to content

Commit

Permalink
Merge pull request #2404 from opengovern/fix-queries
Browse files Browse the repository at this point in the history
fix: validate compliance jobs before running
  • Loading branch information
artaasadi authored Jan 9, 2025
2 parents 1c235b9 + 2547326 commit ee042fa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion services/scheduler/schedulers/compliance/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions services/scheduler/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit ee042fa

Please sign in to comment.