Project

General

Profile

Actions

Bug #34232

open

Clean discovery attributes on managed hosts too

Added by Lukas Zapletal over 2 years ago. Updated over 1 year ago.

Status:
Ready For Testing
Priority:
Normal
Category:
-
Difficulty:
Triaged:
Yes
Fixed in Releases:
Found in Releases:

Description

Discovered hosts have 1:1 relationship to DiscoveryAttributeSet model, in Rails the relationship is also specified for the "Host::Discovered" STI class.

During discovered provisioning, application performs a ton of stuff and we do not use SQL transactions due to the fact it breaks callbacks (thus Dynflow/Tasks). When discovery process fails, an incorrect managed host can be sometimes left in the database. The host was already changed to Host::Managed type, but transaction was not processed to the end, when DiscoveryAttributeSet is deleted.

Such a host now still have a related record in the SQL database (with its FOREIGN KEY constraint), but Rails does not see the relationship anymore as the type is not Host::Discovered. Any attempt to delete such host will fail with a foreign key SQL error.

The solution is to simply extend the managed host to also clean up all (now irrelevant) DiscoveryAttributeSet records on delete.

Actions #1

Updated by The Foreman Bot over 2 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman_discovery/pull/561 added
Actions #2

Updated by Ewoud Kohl van Wijngaarden over 1 year ago

  • Target version deleted (Discovery Plugin 16.0)
Actions

Also available in: Atom PDF