The old patch did not pass review because I was unable to explain the motivation. The reason for the fallback is that only cloud compute resources usually provide IP addresses but virtualization do not. Our users often associate finish templates with libvirt or VMWare but it does not work at all. This only applies to externally managed networks where we don't know the IP (no reservation made by Foreman).
Now there is a question of safety, with incorrect DNS setup, Foreman could run finish script on incorrect server. Therefore I am sending this patch for discussion - I think I could make this behavior an opt-it via setting.
Related issues
Feature #18765: Use hostname instead IP address for finish script
Fixes #18765 - finish script use FQDN when IP is missing
This is resurrect of
https://github.com/theforeman/foreman/pull/2171/files
The old patch did not pass review because I was unable to explain the
motivation. The reason for the fallback is that only cloud compute
resources usually provide IP addresses but virtualization do not. Our
users often associate finish templates with libvirt or VMWare but it
does not work at all. This only applies to externally managed networks
where we don't know the IP (no reservation made by Foreman).
Now there is a question of safety, with incorrect DNS setup, Foreman
could run finish script on incorrect server. Therefore I am sending this
patch for discussion - I think I could make this behavior an opt-it via
setting.