A task that allows cleanup of DHCP subnets.
QA: Create a host without Subnet - DHCP Capsule. Then assign Subnet - DHCP Capsule and run cleanup. And vice versa.
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/27975 has been resolved.
Tested on Satellite 6.8 Snap 16 using following scenarios:
Scenario A) Add missing DHCP records
1. Enable DHCP proxy on a Satellite server.
2. Create a managed network
3. Define and provision a host connected to the managed network, assign an IPv4 address to it, and let the host acquire the address from DHCP.
4. Manually edit /var/lib/dhcpd/dhcpd.leases file, find the record of the host created in the step 3, and remove it.
5. Restart dhcpd service
6. Run "foreman-rake orchestration:dhcp:add_missing subnet_name=<networkname> perform=1"
The record deleted in the step 4 will be recreated in dhcpd.leases file, with messages in production.log similar to this:
2020-09-23T06:58:13 [W|app|] Host julie-magill.example.com needs config rebuild
2020-09-23T06:58:13 [I|app|] Delete DHCP reservation julie-magill.example.com for julie-magill.example.com-56:6f:0d:72:00:61/10.1.4.105
2020-09-23T06:58:14 [I|app|] Create DHCP reservation julie-magill.example.com for julie-magill.example.com-56:6f:0d:72:00:61/10.1.4.105
1. Edit manually /var/lib/dhcpd/dhcpd.leases file and add a bogus DHCP record.
2. Restart dhcpd service
3. Run "foreman-rake orchestration:dhcp:remove_offending subnet_name=<networkname> perform=1"
The bogus record created in step 1 will get removed, with messages in production.log similar to this:
2020-09-23T07:08:16 [W|app|] DHCP record mess.example.com-56:6f:0d:72:00:65/10.1.4.103 not found in DB, deleting
2020-09-23T07:08:16 [I|app|] DHCP record julie-magill.example.com-56:6f:0d:72:00:61/10.1.4.105 is up-to-date
2020-09-23T07:08:16 [I|app|] DHCP record shana-cloud.example.com-52:54:00:96:45:81/10.1.4.102 is up-to-date
Dropping "perform=1" from commands enables dry-run with messages present in the production.log, but not doing any changes to dhcpd.leases.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory (Important: Satellite 6.8 release), and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.