<commit_before>import forEach from 'lodash/forEach'

export const getDefaultNetworkForVif = (vif, host, pifs, networks) => {
  const nameLabel = networks[vif.$network].name_label
  let defaultNetwork
  forEach(host.$PIFs, pifId => {
    const pif = pifs[pifId]
    if (pif.ip && networks[pif.$network].name_label === nameLabel) {
      defaultNetwork = pif.$network
      return false
    }
  })
  return defaultNetwork
}<commit_msg>fix(getDefaultNetworkForVif): allow PIFs with no IP (#1830)<commit_after>import forEach from 'lodash/forEach'

export const getDefaultNetworkForVif = (vif, host, pifs, networks) => {
  const nameLabel = networks[vif.$network].name_label
  let defaultNetwork
  forEach(host.$PIFs, pifId => {
    const pif = pifs[pifId]
    if (networks[pif.$network].name_label === nameLabel) {
      defaultNetwork = pif.$network
      return false
    }
  })
  return defaultNetwork
}
{'fraction_non_alphanumeric': 0.11862527716186252, 'fraction_numerical': 0.004434589800443459, 'mean_word_length': 4.073033707865169, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '884253', 'n_tokens_mistral': 304, 'n_tokens_neox': 295, 'n_words': 67}