Bug 1575092 - The API create host call should work without specifying medium explicitly
Summary: The API create host call should work without specifying medium explicitly
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hosts
Version: 6.3.1
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-05-04 18:10 UTC by Amaani S Karimi
Modified: 2023-09-15 00:07 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-04-13 17:40:02 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 3433051 0 None None None 2018-05-04 18:56:32 UTC

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


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