Creating a host using REST API on Red Hat Satellite 6 fails with error Medium cannot be blank.
Environment
- Red Hat Satellite 6.3.1.
Issue
- Creating a host using REST API fails with error Medium can't be blank.
# 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.X.X\",\"architecture_name\":\"x86_64\",\"ptable_name\":\"Kickstart default\",\"root_pass\":\"changeme\",\"location_id\":\"2\"}" https://satellite.lab.example.com/api/v2/hosts
{
"error": {"id":null,"errors":{"medium_id":["can't be blank"]},"full_messages":["Medium can't be blank"]}
}
Resolution
- This is a known issue This content is not included.BZ #1575092 and has been escalated to the Red Hat Satellite 6 engineering team.
workaround
- Create a Host Group with the complete Operating System information and execute the following command with necessary changes:
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.X.X\",\"organization_id\":\"1\",\"location_id\":\"2\"}" https://satellite.lab.example.com/api/v2/hosts
Note: For every Operating System to use there should be a separate Host Group.
For more KB articles/solutions related to Red Hat Satellite 6.x Provisioning Issues, please refer to the Consolidated Troubleshooting Article for Red Hat Satellite 6.x Provisioning related Issues
SBR
Product(s)
Components
Category
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.