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

Support deleting cloud accounts #2060

Merged
merged 1 commit into from
Apr 10, 2024
Merged

Support deleting cloud accounts #2060

merged 1 commit into from
Apr 10, 2024

Conversation

gnmahanth
Copy link
Contributor

@gnmahanth gnmahanth force-pushed the delete-cloud-account branch from e0414a6 to 3455664 Compare April 8, 2024 02:29
@ramanan-ravi ramanan-ravi marked this pull request as ready for review April 8, 2024 15:42
@gnmahanth gnmahanth force-pushed the delete-cloud-account branch 2 times, most recently from f49d5ec to 7f42076 Compare April 9, 2024 04:25
Comment on lines +166 to +171
// delete hosts discovered from cloud
deleteHostsQuery := `
MATCH (n:Node{account_id: $node_id})
WHERE n.agent_running=false
DETACH DELETE n
`
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should not delete the Node directly and leave this job to the clean up task, there are couple of edge cases to be handled
Let's mark it as not running via:

MATCH (n:Node{account_id: $node_id})
SET n.agent_running=false

Instead

Copy link
Contributor

@ibreakthecloud ibreakthecloud left a comment

Choose a reason for hiding this comment

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

sorry for nitpicks :)

deepfence_server/handler/cloud_node.go Outdated Show resolved Hide resolved
}
}

h.AuditUserActivity(r, EventComplianceScan, ActionDelete, req, true)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think auditlogs should be created even if the task fails.
we need a better framework at router level for auditlog, instrumenting all the methods with h.AuditUserActivity is overkill.(not scope of this PR)

deepfence_worker/tasks/scans/delete_cloud_accounts.go Outdated Show resolved Hide resolved
@gnmahanth gnmahanth force-pushed the delete-cloud-account branch from 7f42076 to c33c93f Compare April 9, 2024 08:01
@gnmahanth gnmahanth merged commit 887e90e into main Apr 10, 2024
3 of 4 checks passed
@gnmahanth gnmahanth deleted the delete-cloud-account branch April 10, 2024 06:11
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.

4 participants