Bug 1318938 - Cannot register content host
Summary: Cannot register content host
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hosts
Version: 6.2.0
Hardware: x86_64
OS: Linux
high vote
Target Milestone: Unspecified
Assignee: Justin Sherrill
QA Contact: Sachin Ghai
URL: http://projects.theforeman.org/issues...
: 1320097 (view as bug list)
Depends On:
TreeView+ depends on / blocked
Reported: 2016-03-18 08:19 UTC by Oleksandr Shtaier
Modified: 2019-09-26 17:35 UTC (History)
6 users (show)

Fixed In Version: rubygem-hammer_cli_katello-,rubygem-katello-
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2016-07-27 09:07:23 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Foreman Issue Tracker 13904 None None None 2016-04-22 15:40:59 UTC
Red Hat Product Errata RHBA-2016:1500 normal SHIPPED_LIVE Red Hat Satellite 6.2 Base Libraries 2016-07-27 12:24:38 UTC

Description Oleksandr Shtaier 2016-03-18 08:19:03 UTC
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:

Steps to Reproduce:
1. Try to register (POST call) new content host

Actual results:
Error is raised

Expected results:
New content host is registered

Additional info:

Comment 2 Oleksandr Shtaier 2016-03-18 09:11:48 UTC
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] 

Comment 3 Oleksandr Shtaier 2016-03-21 16:40:20 UTC
Putting regression as functionality worked before

Comment 5 Justin Sherrill 2016-04-01 16:08:07 UTC
Note this api has been replaced with a new 'register' api:

POST /host/subscriptions/

Comment 6 Eric Helms 2016-04-04 16:46:01 UTC
*** Bug 1320097 has been marked as a duplicate of this bug. ***

Comment 8 Sachin Ghai 2016-04-18 09:56:52 UTC
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"

Comment 9 Sachin Ghai 2016-04-18 09:57:35 UTC
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_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"}

Comment 11 errata-xmlrpc 2016-07-27 09:07:23 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.


Note You need to log in before you can comment on or make changes to this bug.