Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ISSUE-1830: Adding Stop scan related changes for Vulnerability, Compliance and Cloud compliance scans #1585

Merged
merged 5 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions deepfence_server/handler/cloud_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,17 @@ func (h *Handler) RegisterCloudNodeAccountHandler(w http.ResponseWriter, r *http
if err != nil {
log.Error().Msgf("Error getting controls for compliance type: %+v", scan.BenchmarkTypes)
}
stopRequested := false
if scan.Status == utils.SCAN_STATUS_CANCELLING {
stopRequested = true
}

varunsharma0286 marked this conversation as resolved.
Show resolved Hide resolved
scanDetail := model.CloudComplianceScanDetails{
ScanId: scan.ScanId,
ScanTypes: scan.BenchmarkTypes,
AccountId: monitoredAccountId,
Benchmarks: benchmarks,
StopRequested: scan.StopRequested,
StopRequested: stopRequested,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
StopRequested: stopRequested,
StopRequested: scan.Status == utils.SCAN_STATUS_CANCELLING,

}
scanList[scan.ScanId] = scanDetail
}
Expand Down Expand Up @@ -125,12 +130,17 @@ func (h *Handler) RegisterCloudNodeAccountHandler(w http.ResponseWriter, r *http
if err != nil {
log.Error().Msgf("Error getting controls for compliance type: %+v", scan.BenchmarkTypes)
}

stopRequested := false
if scan.Status == utils.SCAN_STATUS_CANCELLING {
stopRequested = true
}
varunsharma0286 marked this conversation as resolved.
Show resolved Hide resolved
scanDetail := model.CloudComplianceScanDetails{
ScanId: scan.ScanId,
ScanTypes: scan.BenchmarkTypes,
AccountId: req.CloudAccount,
Benchmarks: benchmarks,
StopRequested: scan.StopRequested,
StopRequested: stopRequested,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
StopRequested: stopRequested,
StopRequested: scan.Status == utils.SCAN_STATUS_CANCELLING,

}
scanList[scan.ScanId] = scanDetail
}
Expand Down
1 change: 0 additions & 1 deletion deepfence_server/model/scans.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ type ScanInfo struct {
NodeType string `json:"node_type" required:"true"`
SeverityCounts map[string]int32 `json:"severity_counts" required:"true"`
NodeName string `json:"node_name" required:"true"`
StopRequested bool `json:"stop_requested"`
}

type ComplianceScanInfo struct {
Expand Down
1 change: 0 additions & 1 deletion deepfence_server/reporters/scan/scan_reporters.go
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,6 @@ func GetCloudCompliancePendingScansList(ctx context.Context, scanType utils.Neo4
},
BenchmarkTypes: nil,
}
tmp.StopRequested = true
stoppingScansInfo = append(stoppingScansInfo, tmp)
}

Expand Down