Bug 1327244
Summary: | POST/PUT /api/v2/hosts (host create/update) does not document the lifecycle_environment_id and content_view_id options. | ||
---|---|---|---|
Product: | Red Hat Satellite | Reporter: | Andrii Balakhtar <abalakht> |
Component: | API | Assignee: | Justin Sherrill <jsherril> |
Status: | CLOSED ERRATA | QA Contact: | Lukas Zapletal <lzap> |
Severity: | medium | Docs Contact: | |
Priority: | unspecified | ||
Version: | 6.2.0 | CC: | bbuckingham, bkearney, ehelms, jsherril, lzap |
Target Milestone: | Unspecified | Keywords: | Reopened, Triaged |
Target Release: | Unused | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
URL: | http://projects.theforeman.org/issues/15165 | ||
Whiteboard: | |||
Fixed In Version: | rubygem-katello-3.0.0.38-1 | Doc Type: | Bug Fix |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2016-07-27 11:22:37 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: |
Description
Andrii Balakhtar
2016-04-14 14:43:59 UTC
Note that /api/v2/hosts does accept 'environment_id', but that's puppet environment id, not lifecycle environment. If you try to pass lifecycle environment id, you'll receive smth like this: Received HTTP 500 response: { "error": {"message":"ERROR: insert or update on table \"hosts\" violates foreign key constraint \"hosts_environment_id_fk\"\nDETAIL: Key (environment_id)=(1637) is not present in table \"environments\".\n"} Hi, As part of 6.2 the host unification feature sought to unify hosts and content hosts. As a result hosts now have 'facets' which contain additional information. You will want to modify your PUT request to look like: PUT /api/v2/hosts/ID { "content_facet_attributes": { "lifecycle_environment_id": 123, "content_view_id": 456 } } This is not currently documented as part of the apipie params, i will repurpose this bz for that. Justin, Thanks for clarification. It's not only about PUT, POST is missing this info too, i'll update bug summary. Also, just to clarify, user is supposed to pass ids in 'content_facet_attributes', but satellite returns them in 'content' (not 'content_facet_attributes'). Is it expected behavior? Hi Andrii, yes that was half technical issue half oversight, i've opened this bz to resolve that issue. It will not make beta but will make 6.2 GA https://bugzilla.redhat.com/show_bug.cgi?id=1328139 -Justin Reading back, this appears to be 1/2 answered in the bug and 1/2 solved by https://bugzilla.redhat.com/show_bug.cgi?id=1328139 which is currently ON_QA. I am therefore closing this as NOTABUG. If I have missed anything, please let me know and I will re-open. This is still a valid bug, as the options are not documented in https://bugzilla.redhat.com/show_bug.cgi?id=1328139 As per comment #3 (and the title change) this bz is still valid for documenting those api options. Connecting redmine issue http://projects.theforeman.org/issues/15165 from this bug Upstream bug component is API Moving to POST since upstream bug http://projects.theforeman.org/issues/15165 has been closed Looks like the change is present in SNAP 16: [root@hp-dl360g7-01 ~]# rpm -q satellite katello foreman satellite-6.2.0-17.0.el7sat.noarch katello-3.0.0-8.el7sat.noarch foreman-1.11.0.39-1.el7sat.noarch [root@hp-dl360g7-01 ~]# cat /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.51/app/controllers/katello/api/v2/host_contents_controller.rb module Katello class Api::V2::HostContentsController < Katello::Api::V2::ApiController def_param_group :content_facet_attributes do param :content_view_id, Integer param :lifecycle_environment_id, Integer param :kickstart_repository_id, Integer, :desc => N_("Repository Id associated with the kickstart repo used for provisioning") end end end https://xxxx.brq.redhat.com/apidoc/v2/hosts/create.html contains: host[content_facet_attributes] optional , nil allowed Parameters for host's content_facet facet Validations: Hash host[content_facet_attributes][content_view_id] optional , nil allowed Validations: Integer host[content_facet_attributes][lifecycle_environment_id] optional , nil allowed Validations: Integer host[content_facet_attributes][kickstart_repository_id] optional , nil allowed Repository Id associated with the kickstart repo used for provisioning Validations: Integer 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-2016:1501 |