Project

General

Profile

Bug #10365

Migration to delete duplicate tokens doesn't work when there are no managed hosts

Added by Ori Rabin almost 8 years ago. Updated almost 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Difficulty:
Triaged:
No
Bugzilla link:
Fixed in Releases:
Found in Releases:
Red Hat JIRA:

Description

The migration to fix: http://projects.theforeman.org/issues/9597
finds all the tokens that don't belong to a managed host.
When there are no managed hosts

Host::Managed.all.map(&:token).compact

is empty and so this line:
https://github.com/theforeman/foreman_discovery/commit/bc01733928b6babaf0feefbbce326169ae588b08#diff-791d17258792727551dfb2f3bb0e43b1R3
doesn't delete anything.

To fix this if there are no manged hosts all of the tokens should be deleted.


Related issues

Related to Discovery - Bug #9597: FK violation when trying to delete a discovered host after provisionClosed2015-03-01

Associated revisions

Revision 52cd340a (diff)
Added by Ori Rabin almost 8 years ago

Fixes #10365 - Removing all tokens when there are no managed hosts

History

#1 Updated by The Foreman Bot almost 8 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman_discovery/pull/179 added
  • Pull request deleted ()

#2 Updated by Ori Rabin almost 8 years ago

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

#3 Updated by Ori Rabin almost 8 years ago

  • Related to Bug #9597: FK violation when trying to delete a discovered host after provision added

Also available in: Atom PDF