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

Posture counts #1653

Merged
merged 3 commits into from
Oct 11, 2023
Merged

Posture counts #1653

merged 3 commits into from
Oct 11, 2023

Conversation

gnmahanth
Copy link
Contributor

@gnmahanth gnmahanth commented Oct 10, 2023

Fixes #

Changes proposed in this pull request:

  • scan_count should be number of accounts which are scanned irrespective of active or inactive accounts
  • trigger CachePostureProviders task on detecting compliance scan success, this fixes the delay in sync of cached posture counts

@gnmahanth gnmahanth marked this pull request as ready for review October 11, 2023 05:03
@@ -237,9 +238,9 @@ func CachePostureProviders(ctx context.Context, task *asynq.Task) error {

scan_count_query = `
MATCH (n:` + string(neo4jNodeType) + `)
WHERE n.pseudo=false and n.active=true and n.agent_running=true
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the condition n.agent_running=true not required for linux posture count too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hosts with agent_running=false are not allowed to scan so they will not appear here

complete := false

for i := range data {
if data[i]["scan_status"].(string) == utils.SCAN_STATUS_SUCCESS {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to check if string conversion gave no error? Otherwise, might run into runtime error

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we dont need to check here as this field is guaranteed to have string data

@gnmahanth gnmahanth merged commit 9bf3e3e into main Oct 11, 2023
@gnmahanth gnmahanth deleted the posture-counts branch October 11, 2023 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants