Project

General

Profile

Actions

Bug #16061

closed

automatical ip assignment not working for non-primary interfaces

Added by Klaas D over 8 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Host creation
Target version:
Difficulty:
Triaged:
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

Actions

Also available in: Atom PDF