def _get_onboot_ifaces_by_policy(self, policy): """Get network interfaces that shoud have ONBOOT set to 'yes' by policy.""" ifaces = [] if policy is NetworkOnBoot.FIRST_WIRED_WITH_LINK: # choose first device having link log.info("Onboot policy: choosing the first device having link.") for device in self.nm_client.get_devices(): if device.get_device_type() not in supported_device_types: continue if device.get_device_type() == NM.DeviceType.WIFI: continue if device.get_carrier(): ifaces.append(device.get_iface()) break elif policy is NetworkOnBoot.DEFAULT_ROUTE_DEVICE: # choose the device used during installation # (ie for majority of cases the one having the default route) log.info("Onboot policy: choosing the default route device.") iface = get_default_route_iface() or get_default_route_iface(family="inet6") if iface: device = self.nm_client.get_device_by_iface(iface) if device.get_device_type() != NM.DeviceType.WIFI: ifaces.append(iface) return ifaces
def _get_onboot_ifaces_by_policy(self, policy): """Get network interfaces that shoud have ONBOOT set to 'yes' by policy.""" ifaces = [] if policy is NetworkOnBoot.FIRST_WIRED_WITH_LINK: # choose first device having link log.info("Onboot policy: choosing the first device having link.") for device in self.nm_client.get_devices(): if device.get_device_type() not in supported_device_types: continue if device.get_device_type() == NM.DeviceType.WIFI: continue if device.get_carrier(): ifaces.append(device.get_iface()) break elif policy is NetworkOnBoot.DEFAULT_ROUTE_DEVICE: # choose the device used during installation # (ie for majority of cases the one having the default route) log.info("Onboot policy: choosing the default route device.") iface = get_default_route_iface() or get_default_route_iface(family="inet6") if iface: device = self.nm_client.get_device_by_iface(iface) if device.get_device_type() != NM.DeviceType.WIFI: ifaces.append(iface) return ifaces