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.
Description of problem:
When we try to update existing host over API with the PUT statement and there is a NIC configuration as part of the API call, we receive the following error:
{
"data": {
"error": {
"id": 5469,
"errors": {
"interfaces.primary": [
"host already has primary interface"
],
"interfaces.mac": [
"has already been taken"
],
"interfaces.ip": [
"has already been taken"
],
"interfaces.name": [
"has already been taken"
]
},
"full_messages": [
"Primary host already has primary interface",
"Mac has already been taken",
"Ip has already been taken",
"Name has already been taken"
]
}
How reproducible:
Always, just try to alter the NIC parameters via API with PUT statement, or keep the parameters same.
Steps to Reproduce:
1. Create a json file with new host configuration
2. Call the API
3.
Actual results:
Error messages as mentioned in the Problem Description.
Expected results:
No errors - if nothing is changed the parameters should be ignored.
The API looks like this:
{
"name": "short-hostname",
"architecture_id": 1,
"operatingsystem_id": 19,
"ptable_id": 208,
"medium_id": 21,
"location_id": 5,
"organization_id": 3,
"domain_id": 1,
"interfaces_attributes": [
{
"ip": "1.2.3.4",
"mac": "00:aa:26:bb:13:cc",
"type": "interface",
"name": "short-hostname.example.com",
"subnet_id": 1,
"domain_id": 1,
"identifier": "",
"primary": true
}
],
In this case the parameters of the NIC has not been changed.
If I understand correctly, user is trying to use Host api to manipulate interfaces, which is usually hard due to correrctly defining all attributes. I'd recommend using the interfaces PAI enpoint directly, see apidoc for interfaces, e.g. GET /api/hosts/:host_id/interfaces
Thanks mhulan for information.
To sum up:
when user tries to create new interface with host edit API endpoint, the separate NIC API endpoints should be used as mentioned in comment #3.
Instead of the documentation update the error message was improved.
If that is not enough, please let us know in separate bugzilla, and link this BZ to a new one.
Verified with sat 6.10 snap 20. The new error message was shown.
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 (Moderate: Satellite 6.10 Release), 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/RHSA-2021:4702
Description of problem: When we try to update existing host over API with the PUT statement and there is a NIC configuration as part of the API call, we receive the following error: { "data": { "error": { "id": 5469, "errors": { "interfaces.primary": [ "host already has primary interface" ], "interfaces.mac": [ "has already been taken" ], "interfaces.ip": [ "has already been taken" ], "interfaces.name": [ "has already been taken" ] }, "full_messages": [ "Primary host already has primary interface", "Mac has already been taken", "Ip has already been taken", "Name has already been taken" ] } How reproducible: Always, just try to alter the NIC parameters via API with PUT statement, or keep the parameters same. Steps to Reproduce: 1. Create a json file with new host configuration 2. Call the API 3. Actual results: Error messages as mentioned in the Problem Description. Expected results: No errors - if nothing is changed the parameters should be ignored. The API looks like this: { "name": "short-hostname", "architecture_id": 1, "operatingsystem_id": 19, "ptable_id": 208, "medium_id": 21, "location_id": 5, "organization_id": 3, "domain_id": 1, "interfaces_attributes": [ { "ip": "1.2.3.4", "mac": "00:aa:26:bb:13:cc", "type": "interface", "name": "short-hostname.example.com", "subnet_id": 1, "domain_id": 1, "identifier": "", "primary": true } ], In this case the parameters of the NIC has not been changed.