DHCP IP conflict on proxy, IP doesn't exist in dhcpd.leases

I’m using Foreman 1.23.1 with two DHCP proxies set as a failover. I can’t reprovision the same host due to error with IP conflict. This error shows up even when an entry in dhcpd.leases doesn’t exist. To avoid this error I have to remove DHCP entry from dhcpd.leases and then restart dhcpd.service

Create DHCP Settings for am2-testapi008.dc.egnyte.lan task failed with the following error: ERF12-6899 [ProxyAPI::ProxyException]: Unable to set DHCP entry ([RestClient::Conflict]: 409 Conflict) for proxy https://am2-foreman-proxy-dhcp01.domain:8443/dhcp

More details, more logs, IP and lease addresses (are they the same?). If you change PXE loader this can lead to such conflict, this has been fixed recently.

i see this conflict in foreman 2.0, seems you’re on many of the bug reports, and this one is the spitting image of what im seeing Bug #26086: Unable to delete a DHCP record: 400 bad request: "XYZ is static - unable to delete" when editing PXE loader - Foreman , is this fixed in 2.0 as well? i don’t run 1.20.3 as noted as fixed in that release so im not sure what’s fixed and whatt’s still a bug

This error message is not a bug, not a root cause. Something (manual intervention, a different bug) made the DHCP records out of sync with Foreman database.

There is a new rake task to show the differences and fix these:

  Orchestration maintainance tasks.

  WARNING: Always backup server data (e.g. DHCP leases file, DNS journal files)
  prior running these tasks. They do nothing by default, unless perform=1 is
  specified.

  Examples:
  foreman-rake orchestration:dhcp:add_missing subnet_name=NAME
    Preview missing DHCP records on a DHCP Smart Proxy.

  foreman-rake orchestration:dhcp:add_missing subnet_name=NAME perform=1
    Do create missing DHCP records on a DHCP Smart Proxy.

  foreman-rake orchestration:dhcp:remove_offending subnet_name=NAME
    Preview offending DHCP records on a DHCP Smart Proxy.

  foreman-rake orchestration:dhcp:remove_offending subnet_name=NAME perform=1
    Do remove offending DHCP records on a DHCP Smart Proxy.