Actions
Bug #38391
openGET request for /api/v2/hosts/:id/enc fails after adding a new interface to an existing host
Description
Description of problem:
API operations for /api/v2/hosts/:id/enc fail after you add a new interface to an existing host.
How reproducible:
Always
Steps to Reproduce:
1. Have an existing host.
2. Add a new interface, e.g:
hammer host interface create --host <hostname> --identifier test --managed false
3. Request to fetch ENC values for the host fails:
curl --request GET --insecure --user xxx:xxx https://`hostname -f`/api/v2/hosts/13/enc
—
{
"displayMessage": "undefined method `to_export' for #<Nic::Base id: 13, mac: nil, ip: nil, type: nil, name: nil, host_id: 10, subnet_id: nil, domain_id: nil, attrs: {}, created_at: \"2025-04-24 10:01:55.726991000 +0000\", updated_at: \"2025-04-24 10:01:55.726991000 +0000\", provider: nil, username: nil, password: nil, virtual: false, link: true, identifier: \"test\", tag: \"\", attached_to: \"\", managed: false, mode: \"balance-rr\", attached_devices: \"\", bond_options: \"\", primary: false, provision: false, compute_attributes: {}, execution: false, ip6: nil, subnet6_id: nil>",
"errors": [
"undefined method `to_export' for #<Nic::Base id: 13, mac: nil, ip: nil, type: nil, name: nil, host_id: 10, subnet_id: nil, domain_id: nil, attrs: {}, created_at: \"2025-04-24 10:01:55.726991000 +0000\", updated_at: \"2025-04-24 10:01:55.726991000 +0000\", provider: nil, username: nil, password: nil, virtual: false, link: true, identifier: \"test\", tag: \"\", attached_to: \"\", managed: false, mode: \"balance-rr\", attached_devices: \"\", bond_options: \"\", primary: false, provision: false, compute_attributes: {}, execution: false, ip6: nil, subnet6_id: nil>"
]
}
—
Actions