Description of problem: I am trying to register new content host through `/katello/api/systems` and not able to achieve that because of next exception: {["ERROR: null value in column \"host_id\" violates not-null constraint\nDETAIL: Failing row contains (436, null, 18, null, 2016-03-17 12:20:37.253934, 2016-03-17 12:20:37.253934).\n"]} I don't see any reference in documentation for parameter like this (https://server/apidoc/v2/systems/create.html) and anyway that error seems a little bit weird I see that API is deprecated, but anyway, we don't have any other way to work with content hosts, so it is still critical part of functionality Version-Release number of selected component (if applicable): 6.2 SNAP4 How reproducible: Always Steps to Reproduce: 1. Try to register (POST call) new content host 2. 3. Actual results: Error is raised Expected results: New content host is registered Additional info:
Issue is also reproducible through Hammer, so is not specific for API. Output from automation run: ``` CLIFactoryError: Failed to create ContentHost with data: { "content-view": null, "content-view-id": "310", "description": null, "guest-ids": null, "host-collection-ids": null, "last-checkin": null, "lifecycle-environment": null, "lifecycle-environment-id": "304", "location": null, "name": "\u74b0\u91e2\u8d7e\u5561\u65a7", "organization": null, "organization-id": "365", "organization-label": null, "release-ver": null, "service-level": null } Command "content-host create" finished with return_code 70 stderr contains following message: [ERROR 2016-03-16 10:11:05 Exception] ERROR: null value in column "host_id" violates not-null constraint Could not create content host: ERROR: null value in column "host_id" violates not-null constraint [ERROR 2016-03-16 10:11:05 Exception] ```
Putting regression as functionality worked before
Note this api has been replaced with a new 'register' api: POST /host/subscriptions/
*** Bug 1320097 has been marked as a duplicate of this bug. ***
Verified with sat6.2 beta snap8.2 I don't see "content-host create" command now via hammer. I think this has been removed as per of host-unification feature and system api's has been deprecated as well. As per comment5 now a new register command is available to create new content-host. ~]# hammer -u admin -p changeme host subscription register --name test --content-view-id 2 --lifecycle-environment-id 1 --organization-id 1 Host successfully registered ~]# hammer -u admin -p changeme host list | grep test 20 | test ~]# hammer -u admin -p changeme content-host list --organization-id 1 | grep test 8ac6363c-a667-4ac1-9bed-dcc676d9a500 | test | 0 [ INFO 2016-04-18 05:34:11 API] POST /api/hosts/subscriptions [DEBUG 2016-04-18 05:34:11 API] Params: { "name" => "test2", "facts" => {}, "lifecycle_environment_id" => 1, "content_view_id" => 2 } [DEBUG 2016-04-18 05:34:11 API] Headers: {} [DEBUG 2016-04-18 05:34:12 API] Response: { "id" => 21, "name" => "test2", "description" => nil, "content_view" => "cv_rhel7", "content_view_id" => nil, "environment" => "Library"
using api's ~]# curl -i -k -u admin:changeme -H "Content-Type: application/json" -X POST -d '{"name":"test3", "lifecycle_environment_id": 1, "content_view_id": 1}' 'https://cloud-qe-3.idmqe.lab.eng.bos.redhat.com/api/hosts/subscriptions' HTTP/1.1 200 OK Date: Mon, 18 Apr 2016 09:54:42 GMT Server: Apache/2.4.6 (Red Hat Enterprise Linux) X-Frame-Options: SAMEORIGIN X-XSS-Protection: 1; mode=block X-Content-Type-Options: nosniff Foreman_version: 1.11.0.14 Foreman_api_version: 2 Apipie-Checksum: e99cc824c2dcbff1e03fc02853dae961 Cache-Control: max-age=0, private, must-revalidate X-Request-Id: 1d0013e4-adcb-42ee-bd7a-9631c9b7d425 X-Runtime: 1.310137 X-Powered-By: Phusion Passenger 4.0.18 Set-Cookie: request_method=POST; path=/ Set-Cookie: _session_id=BAh7B0kiD3Nlc3Npb25faWQGOgZFVEkiJTdlZjUzZDE2Yzc0OTY1NzQxNmY3YTFjMGIyM2IyYjVlBjsAVEkiC2xvY2FsZQY7AEZJIgdlbgY7AEY%3D--e5878e87b74bbb47ce6d8383e46ae57b67035b58; path=/; HttpOnly ETag: "0e9ab8edaca6a81be47d76bb9821f82b" Status: 200 OK Vary: Accept-Encoding Transfer-Encoding: chunked Content-Type: application/json; charset=utf-8 {"id":22,"name":"test3","description":null,"content_view":"Default Organization View","content_view_id":null,"environment":"Library"}
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:1500