Project

General

Profile

Bug #10535

Tokens are created for managed hosts after validation

Added by Ori Rabin about 7 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Host creation
Target version:
Difficulty:
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

set_token is called fr managed host after validations and not after save.
This can't be moved to after_save since the token is needed before save for templates.
The result is a token can be created for a host that eventually isn't saved as a managed host.
I only reproduced this with discovery: http://projects.theforeman.org/issues/9597
when provisioning a discovered host, trying to save causes validations and then a token was created.
As a result after canceling there was a token connected to a discovered host.


Related issues

Related to Discovery - Bug #9597: FK violation when trying to delete a discovered host after provisionClosed2015-03-01
Related to Foreman - Bug #10558: Remove and prevent duplicate tokens via DB migrationClosed2015-05-20
Has duplicate Foreman - Bug #10645: ERROR: update or delete on table "hosts" violates foreign key constraint "tokens_host_id_fk" on table "tokens" DETAIL: Key (id)=(2) is still referenced from table "tokens". Duplicate2015-05-28

Associated revisions

Revision c2ff4bd6 (diff)
Added by Ori Rabin about 7 years ago

Fixes #10535 - building a token instead of creating it until host is saved

Revision 2ac1bed9 (diff)
Added by Ori Rabin about 7 years ago

Fixes #10535 - building a token instead of creating it until host is saved

(cherry picked from commit c2ff4bd6874155459a51af070abb381fd59be262)

History

#1 Updated by Ori Rabin about 7 years ago

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

#2 Updated by Lukas Zapletal about 7 years ago

If this bug is planned to be backported into 1.8, we need to make sure that Discovery migration is copied over into Foreman core. See the PR discussion for more info.

#3 Updated by Dominic Cleal about 7 years ago

  • Category set to Host creation
  • Legacy Backlogs Release (now unused) set to 35

#4 Updated by Dominic Cleal about 7 years ago

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

#5 Updated by Dominic Cleal about 7 years ago

Lukas Zapletal wrote:

If this bug is planned to be backported into 1.8, we need to make sure that Discovery migration is copied over into Foreman core. See the PR discussion for more info.

It needs moving or copying either way, #10558.

#6 Updated by Dominic Cleal about 7 years ago

  • Related to Bug #10558: Remove and prevent duplicate tokens via DB migration added

#7 Updated by Dominic Cleal about 7 years ago

  • Legacy Backlogs Release (now unused) changed from 35 to 56

#8 Updated by Dominic Cleal about 7 years ago

  • Has duplicate Bug #10645: ERROR: update or delete on table "hosts" violates foreign key constraint "tokens_host_id_fk" on table "tokens" DETAIL: Key (id)=(2) is still referenced from table "tokens". added

Also available in: Atom PDF