Project

General

Profile

Bug #21037

"Invalid single-table inheritance type: Host::Discovered is not a subclass of Host::Managed" caused by auditing host

Added by Ivan Necas almost 3 years ago. Updated almost 2 years ago.

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

Description

In the host auditing, we're setting the auditable_class to Host. And in the Host, we're redirecting
all the methods to the Host::Managed. This causes issues, when converting the host from discovered
to managed and creating an audit record of it.

Reproducer (having a discovered host).

host2 = host.become(Host::Managed)
host2.type = "Host::Managed" 
host2.save

Related issues

Related to Discovery - Bug #20972: STI issues with Host::Discovered on Rails 5Duplicate2017-09-17
Related to Foreman - Bug #25207: Invalid single-table inheritance type: Host::Discovered is not a subclass of Host::ManagedClosed
Related to Discovery - Bug #25556: 'Discovery manager' role brokenDuplicate

Associated revisions

Revision b1438ff0 (diff)
Added by Ivan Necas almost 3 years ago

Fixes #21037 - use Host::Base as auditable_type

Otherwise, we are hitting "Invalid single-table inheritance type:
Host::Discovered is not a subclass of Host::Managed" when converting the
host from discovered to managed.

Revision 1f6a9b2c (diff)
Added by Ivan Necas almost 3 years ago

Refs #21037 - address review comments

History

#1 Updated by The Foreman Bot almost 3 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/4863 added

#2 Updated by The Foreman Bot almost 3 years ago

  • Pull request https://github.com/theforeman/foreman/pull/4864 added

#3 Updated by Anonymous almost 3 years ago

  • Pull request deleted (https://github.com/theforeman/foreman/pull/4863)

#4 Updated by Ivan Necas almost 3 years ago

  • Related to Bug #20972: STI issues with Host::Discovered on Rails 5 added

#5 Updated by Ivan Necas almost 3 years ago

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

#6 Updated by Marek Hulán almost 3 years ago

  • Legacy Backlogs Release (now unused) set to 296

#7 Updated by Lukas Zapletal almost 3 years ago

  • Legacy Backlogs Release (now unused) changed from 296 to 240

I actually need this in 1.16 if Rails5 is part of that branch, this is discovery blocker.

#8 Updated by Lukas Zapletal almost 3 years ago

  • Legacy Backlogs Release (now unused) changed from 240 to 296

Ok Rails5 is not part of 1.16.

#9 Updated by Lukas Zapletal almost 2 years ago

  • Related to Bug #25207: Invalid single-table inheritance type: Host::Discovered is not a subclass of Host::Managed added

#10 Updated by Lukas Zapletal almost 2 years ago

  • Triaged set to No

Hello, we have an initial version of a patch that solves this. It's one liner, please apply it, restart and get back to me with feedback:

https://github.com/theforeman/foreman/pull/6192/files

#11 Updated by Lukas Zapletal over 1 year ago

  • Related to Bug #25556: 'Discovery manager' role broken added

Also available in: Atom PDF