Bug 1390153

Summary: /api/v2/hosts/:id does not expose content_source_id
Product: Red Hat Satellite Reporter: Roman Plevka <rplevka>
Component: API - ContentAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: jcallaha
Severity: high Docs Contact:
Priority: high    
Version: 6.2.0CC: akarsale, bbuckingham, bkearney, brubisch, dlezzoum, jcallaha, jentrena, peter.vreman, rplevka, satellite6-bugs, sauchter
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: rubygem-katello-3.0.0.91-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1339613
: 1405520 (view as bug list) Environment:
Last Closed: 2017-01-26 10:43:58 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:
Bug Depends On: 1316897, 1339613    
Bug Blocks: 1115190, 1122832, 1405520    

Comment 2 Bryan Kearney 2016-10-31 12:20:36 UTC
Upstream bug component is API - Content

Comment 3 Bryan Kearney 2016-10-31 12:20:40 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/15697 has been resolved.

Comment 4 jcallaha 2017-01-10 19:41:45 UTC
Verified in Satellite 6.2.7 Snap 1

Querying the host, without modification returns
{
...
"content_source_id": null,
...
}

Submitting a PUT to the host path with a specific valid ID results in that id being saved/displayed in subsequent requests.
{
...
"content_source_id": null,
...
}

Submitting a PUT to the host path with an invalid ID results in the following error message.
{
  "error": {
    "message": "ERROR:  insert or update on table \"hosts\" violates foreign key constraint \"hosts_content_source_id_fk\"\nDETAIL:  Key (content_source_id)=(101) is not present in table \"smart_proxies\".\n"
  }
}

Comment 6 errata-xmlrpc 2017-01-26 10:43:58 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-2017:0197