Project

General

Profile

Actions

Bug #8405

closed

Resolve Templates button on Host#edit broken for multi-nic systems

Added by Greg Sutcliffe over 9 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
High
Category:
Host creation
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

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).


Related issues 2 (0 open2 closed)

Related to Foreman - Bug #9058: Changing organization/location when creating new host resets interfaces setupClosedTom Caspy01/21/2015Actions
Related to Foreman - Bug #11767: Templates are not being resolved in the host formClosedMarek Hulán09/10/2015Actions
Actions #1

Updated by The Foreman Bot over 9 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/1955 added
  • Pull request deleted ()
Actions #2

Updated by Dominic Cleal over 9 years ago

  • Assignee set to Greg Sutcliffe
Actions #3

Updated by Greg Sutcliffe over 9 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100
Actions #4

Updated by Tomáš Strachota about 9 years ago

  • Related to Bug #9058: Changing organization/location when creating new host resets interfaces setup added
Actions #5

Updated by Marek Hulán over 8 years ago

  • Related to Bug #11767: Templates are not being resolved in the host form added
Actions

Also available in: Atom PDF