Bug #17853
closedto_ip_address should be part of the interface scope
Description
When a Host::Discovered becomes a Host::Managed, I see this error:
Dhcp orchestration calls to_ip_address (for the boot server) which is delegated from nic to host but in the host scope it cannot resolve dns because the subnet is nil... if i move to_ip_address to nic::managed this issue seems fixed.
| Foreman::WrappedException: ERF50-9294 [Foreman::WrappedException]: Unable to find IP address for 'xxxx' ([NoMethodError]: undefined method `resolv
er' for nil:NilClass)
| /usr/share/foreman/app/models/host/managed.rb:903:in `rescue in to_ip_address'
| /usr/share/foreman/app/models/host/managed.rb:894:in `to_ip_address'
| /usr/share/foreman/app/models/nic/managed.rb:21:in `to_ip_address'
| /usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:85:in `boot_server'
| /usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:119:in `dhcp_attrs'
| /usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:97:in `build_dhcp_record'
| /usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:25:in `block in dhcp_records'
| /usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:24:in `map'
| /usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:24:in `dhcp_records'
| /usr/share/foreman/app/models/concerns/orchestration/dhcp.rb:56:in `set_dhcp'
| /usr/share/foreman/app/models/concerns/orchestration.rb:195:in `execute'
| /usr/share/foreman/app/models/concerns/orchestration.rb:135:in `block in process'
| /usr/share/foreman/app/models/concerns/orchestration.rb:127:in `each'
| /usr/share/foreman/app/models/concerns/orchestration.rb:127:in `process'
| /usr/share/foreman/app/models/concerns/orchestration.rb:35:in `around_save_orchestration'