Project

General

Profile

Actions

Bug #6412

closed

Trying to remove a DHCP record fails due to an invalid subnet check

Added by David Swift over 9 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
DHCP
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Take three hosts, add them into foreman via API. Then try and remove them. The first deletes fine, but the subsequent deletions fail. The problem is in file , line 196. When the subnet gets searched, the 1st host is not found, and then the entire subnet array is returned to the delete function, which then throws an error.

Pull request coming.


Related issues 1 (0 open1 closed)

Has duplicate Smart Proxy - Bug #6311: Deleting a host and re-creating it generates a DHCP errorDuplicate06/20/2014Actions
Actions #1

Updated by Dominic Cleal over 9 years ago

  • Category set to DHCP
  • Status changed from New to Ready For Testing
  • Assignee set to David Swift
  • Target version set to 1.8.1
Actions #2

Updated by David Swift over 9 years ago

Copying the description I just wrote into github, as it explains this behavior better:

A small correction - if it fails to find the DHCP record of a deleted host in the subnet under evaluation, it will not attempt to delete it from the subnet under evaluation. This allows it to carry on, and actually delete the record that is intended.

The problem arises due to the evaluation of DHCP records with a status of 'deleted'. These records are evaluated against the subnet that contains the actual host we want to delete, and if they are found, they are removed prior to executing the target deletion.

In the case that triggered this bug, the record with the DHCP deleted status was originally in a different subnet before it was removed. On a subsequent delete run for a second host, the previously deleted host could not be found in the subnet under evaluation, and line 198 never returned a value. This left the return value of find_record_by_hostname as the result of subnet.records.each (an array), which then caused the subnet.delete call to throw an error.

A better fix might be to track the subnets of hosts with a DHCP status of deleted, but this gets the job done without added complexity.

HTH.

Actions #3

Updated by Dominic Cleal over 9 years ago

  • translation missing: en.field_release set to 18
Actions #4

Updated by Dominic Cleal over 9 years ago

  • Has duplicate Bug #6311: Deleting a host and re-creating it generates a DHCP error added
Actions #5

Updated by Anonymous over 9 years ago

  • Target version changed from 1.8.1 to 1.8.0
Actions #6

Updated by Bryan Kearney over 9 years ago

  • Bugzilla link set to 1117837
Actions #7

Updated by Anonymous over 9 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100
Actions #8

Updated by Dominic Cleal over 9 years ago

  • Project changed from Foreman to Smart Proxy
  • Category changed from DHCP to DHCP
Actions

Also available in: Atom PDF