Skip to content

Commit

Permalink
add cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
BeryJu committed Nov 25, 2024
1 parent be84d61 commit bc62216
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/roles/dhcp/role_migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,13 @@ func (r *Role) RegisterMigrations() {
MigrationName: "dhcp-move",
ActivateOnVersion: migrate.MustParseConstraint("< 0.17.0"),
CleanupFunc: func(ctx context.Context) error {
r.log.Warn("Cleanup called")
res, err := r.i.KV().Delete(ctx,
r.i.KV().Key(types.KeyRole, types.KeyLegacyLeases).Prefix(true).String(),
clientv3.WithPrefix())
if err != nil {
return err
}
r.log.Info("Successfully cleaned up old DHCP leases", zap.Int64("count", res.Deleted))
return nil
},
HookFunc: func(ctx context.Context) (*storage.Client, error) {
Expand Down

0 comments on commit bc62216

Please sign in to comment.