-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Allow to delete routes #1244
Allow to delete routes #1244
Conversation
1d5b3d3
to
ee1d7fb
Compare
@@ -535,6 +535,11 @@ func (h *Headscale) RefreshMachine(machine *Machine, expiry time.Time) error { | |||
|
|||
// DeleteMachine softs deletes a Machine from the database. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the difference between hard and soft? why do we have them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hard actually deletes the entry in the DB, soft just sets the deleted_at field. We do hard when deleting ephemeral nodes.
@@ -535,6 +535,11 @@ func (h *Headscale) RefreshMachine(machine *Machine, expiry time.Time) error { | |||
|
|||
// DeleteMachine softs deletes a Machine from the database. | |||
func (h *Headscale) DeleteMachine(machine *Machine) error { | |||
err := h.DeleteMachineRoutes(machine) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cant this be done by cascading database deletes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we would use cascade, we would be using soft deleted in the routes https://stackoverflow.com/a/67751408 and I wanted to hard delete them.
This PR adds support to delete routes from the CLI and the API.
It also deletes the routes of a machine when it is deleted (#1228)