get_nic_from_network function fixes

Do not use a Facter:: call within a function since it seems
Foreman-host specific rather than client-node specific (and we just
care about client facts/variables).

Also, make sure not to call gsub on a nil object to avoid mysterious
stack traces.