Skip to content

Commit

Permalink
dhcp: delete leases of a scope when the scope is deleted (#1500)
Browse files Browse the repository at this point in the history
  • Loading branch information
BeryJu authored Feb 11, 2025
1 parent 67d4826 commit d4e6a43
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/roles/dhcp/api_scopes.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,15 @@ func (r *Role) APIScopesDelete() usecase.Interactor {
if err != nil {
return status.Wrap(err, status.Internal)
}
for _, l := range r.leases.Iter() {
if l.ScopeKey != input.Scope {
continue
}
err = l.Delete(ctx)
if err != nil {
return status.Wrap(err, status.Internal)
}
}
return nil
})
u.SetName("dhcp.delete_scopes")
Expand Down

0 comments on commit d4e6a43

Please sign in to comment.