Project

General

Profile

Bug #16061

automatical ip assignment not working for non-primary interfaces

Added by Klaas D over 3 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Host creation
Target version:
Difficulty:
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

Hi,
when creating a server over the api the automatical ip assignment only works for the primary interface, the other configured interfaces are being created but no ip is set.

The call from production.log:

Parameters: {"host"=>{"name"=>"server1.example.com", "location_id"=>"3", "organization_id"=>"1", "compute_resource_id"=>"2", "compute_profile_id"=>"2", "hostgroup_id"=>"6", "interfaces_attributes"=>[{"identifier"=>"eth0", "name"=>"server1", "subnet_id"=>7, "domain_id"=>2, "managed"=>true, "provision"=>true, "primary"=>true}, {"identifier"=>"eth1", "name"=>"server1i1", "subnet_id"=>4, "domain_id"=>2, "managed"=>true, "provision"=>false, "primary"=>false}, {"identifier"=>"eth2", "name"=>"server1i2", "subnet_id"=>6, "domain_id"=>2, "managed"=>true, "provision"=>false, "primary"=>false}, {"identifier"=>"eth3", "name"=>"server1i3", "subnet_id"=>5, "domain_id"=>2, "managed"=>true, "provision"=>false, "primary"=>false}], "host_parameters_attributes"=>[{"name"=>"E-Mail", "value"=>"[FILTERED]"}], "build"=>true}, "apiv"=>"v2"}

I think the set_ip_address function needs to iterate over all interfaces that are set to managed
https://github.com/theforeman/foreman/blob/develop/app/models/host/managed.rb#L630-L635

Greetings
Klaas

Associated revisions

Revision a86dcf44 (diff)
Added by Klaas Demter over 3 years ago

Fixes #16061 - auto ip assignment for non-primary interfaces

Squashed commit with a test case and the changes Timo suggested thanks
for the help also tried to decrease complexity of my change.

Revision 443c3007 (diff)
Added by Klaas Demter over 3 years ago

Fixes #16061 - auto ip assignment for non-primary interfaces

Squashed commit with a test case and the changes Timo suggested thanks
for the help also tried to decrease complexity of my change.

(cherry picked from commit a86dcf44b236e59c1b4370c1a51749360420e69e)

History

#1 Updated by The Foreman Bot over 3 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/3735 added

#2 Updated by Anonymous over 3 years ago

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

#3 Updated by Dominic Cleal over 3 years ago

  • Assignee set to Klaas D
  • Legacy Backlogs Release (now unused) set to 175

Also available in: Atom PDF