Adding the same machine after removing it causes db constraints errors
While I was reviewing !63 (merged), I did the following test:
- I've added a machine with one Kea server having a subnet within the shared network. It did it fine, although didn't show the subnet because the logic there does not support subnets within a shared network
- I removed the machine via the UI. The machine got marked as deleted in the db.
- I changed the configuration of the Kea server by making the subnet global rather than belong to a shared network.
- I used UI to add the machine. The machine was added again but an error was reported while adding the app because of the constraint violation:
RRO[2020-02-03 13:46:43] restimpl.go:150 problem with inserting app &{0 0001-01-01 00:00:00 +0000 UTC 0001-01-01 00:00:00 +0000 UTC 1 0xc0004ba900 kea 192.168.56.33 8000 false {1.7.3-git} { [0xc000194460 0xc0001b36c0 0xc0001b3730]}}: ERROR #23505 duplicate key value violates unique constraint "app_machine_id_ctrl_port_key
The machine was undeleted it seems but the app configuration remains old.