Bug 1638403

Summary: Create Host fails with: "Invalid single-table inheritance type: Host::Discovered is not a subclass of Host::Managed"
Product: Red Hat Satellite Reporter: Dylan Gross <dgross>
Component: Discovery PluginAssignee: Lukas Zapletal <lzap>
Status: CLOSED ERRATA QA Contact: Peter Ondrejka <pondrejk>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.4CC: inecas, lzap, mmccune, pcreech, rabajaj, zhunting
Target Milestone: 6.4.1Keywords: Regression, Triaged
Target Release: Unused   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: foreman-1.18.0.39-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-12-06 22:32:53 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Stack Trace none

Description Dylan Gross 2018-10-11 13:25:54 UTC
Description of problem:

   Attempting to create a Host in Satellite 6.4 fails with the following error:
"Invalid single-table inheritance type: Host::Discovered is not a subclass of Host::Managed"


Version-Release number of selected component (if applicable):

  Red Hat Satellite 6.4

How reproducible:

Steps to Reproduce:
1.   Create a non-admin user - see "User_roles.txt" attachment
2.   Use API to attempt host creation - See "api_call.txt" attachement

Actual results:

  Logs and output return error:
    "Invalid single-table inheritance type: Host::Discovered is not a subclass of Host::Managed"

  (Also see "production.log.gz" attachment)

Expected results:

  Host is created successfully.

Additional info:

  This is not an issue when using "admin", but only a user with specific roles.
However, these same users/roles were able to create the host in Satellite 6.3 successfully.   (Thus setting "regression")

Comment 7 Dylan Gross 2018-10-26 18:44:27 UTC
Per the support case, it turned out that the omitting the Step 4 of removing the pre-6.4 discovered hosts in https://access.redhat.com/documentation/en-us/red_hat_satellite/6.4/html/upgrading_and_updating_red_hat_satellite/upgrading_red_hat_satellite#upgrading_satellite_server_parent  contributed to the conflict that was preventing non-admin users from creating the hosts.  

Once those Discovered Hosts were removed, the issue went away.

This bugzilla can probably be closed

Comment 8 Mike McCune 2018-10-31 14:36:56 UTC
This is now recurring in the customer environment whenever there is a discovered host. This raises the severity as it is blocking provisioning

Comment 9 Mike McCune 2018-10-31 14:39:25 UTC
You don't need a custom role, you can use our pre-existing Org Admin role:


With a discovered host in the queue:

User with org-admin:
10.3969349861   seconds: create_host   POST   500 https://example.com/api/v2/hosts
u'{\n  "error": {"message":"Invalid single-table inheritance type: Host::Discovered is not a subclass of Host::Managed"}\n}\n'

User with full admin:
1.47844290733   seconds: create_host   POST   201 https://example.com/api/v2/hosts

Comment 10 Mike McCune 2018-10-31 15:03:27 UTC
Created attachment 1499432 [details]
Stack Trace

Comment 11 Mike McCune 2018-10-31 15:03:44 UTC
Uploaded the full error

Comment 12 Ivan Necas 2018-10-31 15:05:43 UTC
Connecting redmine issue https://projects.theforeman.org/issues/25207 from this bug

Comment 13 Lukas Zapletal 2018-10-31 15:45:41 UTC
Guys, looking into this. Upstream reported this as well and it was in my TODO anyway.

Comment 14 Lukas Zapletal 2018-11-01 12:05:21 UTC
Hello,

there's one liner available passing upstream tests:

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

In case customer do not want to wait, please assist them with hotfixing their instance(s) until we do a final z-stream release.

Comment 16 Satellite Program 2018-11-07 11:08:43 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/25207 has been resolved.

Comment 19 Peter Ondrejka 2018-11-15 16:26:41 UTC
Verified on Satellite 6.4 sn 1, having unprovisioned discovered host present in Satellite I was able to create a host via api using a user with org-admin role

Comment 22 errata-xmlrpc 2018-12-06 22:32:53 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:3799