Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1575092

Summary: The API create host call should work without specifying medium explicitly
Product: Red Hat Satellite Reporter: Amaani S Karimi <akarimi>
Component: HostsAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED UPSTREAM QA Contact:
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.3.1CC: ajambhul, akarimi, akarsale, apatel, avroy, inecas, jsinclea, mhulan, rdesouza, tbrisker, tstrachota
Target Milestone: UnspecifiedKeywords: Reopened, Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-02-10 03:59:17 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 Amaani S Karimi 2018-05-04 18:10:25 UTC
Description of problem:
creating a host using REST API fails with error Medium can't be blank

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

Satellite 6.3.1


How reproducible:
Always

Steps to Reproduce:
curl -H "Accept:application/json,version=2" -H "Content-Type:application/json" -X POST -u admin:redhat -k -d "{\"name\":\"testhost\",\"domain_name\":\"lab.example.com\",\"operatingsystem_name\":\"RHEL Server 7.5\",\"organization_id\":\"1\",\"mac\":\"52-54-00-57-83-33\",\"build\":true,\"ip\":\"192.168.123.10\",\"architecture_name\":\"x86_64\",\"ptable_name\":\"Kickstart default\",\"root_pass\":\"changeme\",\"location_id\":\"2\"}" https://$(hostname -f)/api/v2/hosts
{
  "error": {"id":null,"errors":{"medium_id":["can't be blank"]},"full_messages":["Medium can't be blank"]}
}


Actual results:
As we fully support synced media [1] for kickstart repository, I assume passing medium_id shouldn't be mandatory. This should automatically resolve to the correct media. 
           [1] - https://bugzilla.redhat.com/show_bug.cgi?id=1382775

Also, we don't know what medium_id to pass in as we don't expose media listing using either hammer or foreman-rake console

Expected results:
Creating a host with REST API should work as expected.

Comment 1 Amaani S Karimi 2018-05-04 18:12:16 UTC
**WORKAROUND**

Create a Host Group with the Operating System selection already filled in it. 

curl -H "Accept:application/json,version=2" -H "Content-Type:application/json" -X POST -u admin:redhat -k -d "{\"name\":\"testhost\",\"hostgroup_id\":\"2\",\"mac\":\"52-54-00-57-83-33\",\"build\":true,\"ip\":\"192.168.123.10\",\"organization_id\":\"1\",\"location_id\":\"2\"}" https://$(hostname -f)/api/v2/hosts

NOTE: From the end user point of view, this will be a tedious process as he would need to create a Host Group for each operating that he would like to build.

Comment 3 Ivan Necas 2018-05-18 14:20:03 UTC
Among others, content-source-id and kickstart-repository-id need to be specified. Have a look at https://bugzilla.redhat.com/show_bug.cgi?id=1415707#c4 with an example of such a command. I'm going to close this until showed that this options as in https://bugzilla.redhat.com/show_bug.cgi?id=1415707#c4 were used and it still doesn't work.

Comment 5 Mike McCune 2021-03-11 18:51:16 UTC
Upon review of our valid but aging backlog the Satellite Team has concluded that this Bugzilla does not meet the criteria for a resolution in the near term, and are planning to close in one month's time. If you have any concerns about this, please contact your Red Hat Account team.  Thank you.

Comment 7 Mike McCune 2021-04-13 17:40:02 UTC
Thank you for your interest in Satellite 6. We have evaluated this request, and while we recognize that it is a valid request, we do not expect this to be implemented in the product in the foreseeable future. This is due to other priorities for the product, and not a reflection on the request itself. We are therefore closing this out as WONTFIX. If you have any concerns about this, please do not reopen. Instead, feel free to contact your Red Hat Account Team. Thank you.

Comment 8 Anand Jambhulkar 2021-05-25 18:10:58 UTC
Hi,

By implementing the solution specified in the following KCS article - https://access.redhat.com/solutions/3433051 the issue got resolved.

However, it breaks the possibility to inherit values from parent objects.

The customer has asked for fixing the bugzilla.

Please let me know what to tell them further.


Thanks & Regards,
Anand Jambhulkar

Comment 11 Red Hat Bugzilla 2023-09-15 00:07:58 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 500 days

Comment 13 Red Hat Bugzilla 2025-02-10 03:59:17 UTC
This product has been discontinued or is no longer tracked in Red Hat Bugzilla.