Bug #8405
closedResolve Templates button on Host#edit broken for multi-nic systems
Description
If a host has extra interfaces, then the Resolve Templates button is broken for existing hosts, because the DB tries to match Nics with IDs to a Host without. THis is because we call Host.new(params[:host]) which creates a new Host with id=nil, but uses the nested attrs for the nics. This leads to logs like this:
Nic::Base Load (0.2ms) SELECT "nics".* FROM "nics" WHERE "nics"."host_id" IS NULL AND "nics"."id" IN (17, 19) ORDER BY identifier
not found: Couldn't find Nic::Base with ID=17 for Host::Managed with ID=
To reproduce, create a host with at least one nic in the Network tab (i.e not just the primary interface). Save it (as it works fine while both entities have id=nil), then edit and try the Resolve Templates button. It should say "Sorry but no templates were configured."
To fix, we should probably a) drop the nested attrs for the application.js#template_info JS function, and b) drop them again in the controller (in case someone hits it from outside the UI).
Updated by The Foreman Bot about 10 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/1955 added
- Pull request deleted (
)
Updated by Greg Sutcliffe about 10 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset be4602e87f8a8f35f49c8568fdea41e1570e5bb2.
Updated by Tomáš Strachota almost 10 years ago
- Related to Bug #9058: Changing organization/location when creating new host resets interfaces setup added
Updated by Marek Hulán over 9 years ago
- Related to Bug #11767: Templates are not being resolved in the host form added