kea-admin lease-upload fails if CSV file contains duplicate leases
$ kea-admin lease-upload mysql -4 -i /tmp/kea-dhcp4.csv
ERROR 1062 (23000) at line 1: Duplicate entry '167772160' for key 'PRIMARY'
$ kea-admin lease-upload pgsql -4 -i /tmp/kea-dhcp4.csv
ERROR: duplicate key value violates unique constraint "lease4_pkey"
DETAIL: Key (address)=(167772160) already exists.
Same for v6.
Duplicate leases are common when running Kea with memfile backend.
Workaround 1: start a dummy Kea server with a low lfc-timer
e.g. 1 so that it calls kea-lfc and then use the curated csv.2
file.
Workaround 2: call LFC yourself and then use csv.2
file: kea-lfc -4 -x /tmp/kea-dhcp4.csv.2 -i /tmp/kea-dhcp4.csv.1 -o /tmp/kea-dhcp4.csv.output -f /tmp/kea-dhcp4.csv.completed -p /tmp/kea-dhcp4.csv.pid -cignored-path