def generate_kickstart_network_data(self, network_data_class): rv = [] for cfg in self._device_configurations.get_all(): network_data = None if cfg.device_type != NM.DeviceType.WIFI and cfg.connection_uuid: ifcfg = get_ifcfg_file([("UUID", cfg.connection_uuid)]) if not ifcfg: log.debug("Ifcfg file for %s not found.") continue network_data = get_kickstart_network_data(ifcfg, self.nm_client, network_data_class) if not network_data: log.debug("Device configuration %s does not generate any kickstart data", cfg) continue if cfg.device_name: if self._is_device_activated(cfg.device_name): network_data.activate = True else: # First network command defaults to --activate so we must # use --no-activate explicitly to prevent the default # (Default value is None) if not rv: network_data.activate = False rv.append(network_data) return rv
def _has_any_onboot_yes_device(self, device_configurations): """Does any device have ONBOOT value set to 'yes'?""" uuids = [dev_cfg.connection_uuid for dev_cfg in device_configurations.get_all() if dev_cfg.connection_uuid] for uuid in uuids: ifcfg = get_ifcfg_file([("UUID", uuid)]) if ifcfg: ifcfg.read() if ifcfg.get('ONBOOT') != "no": return True return False
def _has_any_onboot_yes_device(self, device_configurations): """Does any device have ONBOOT value set to 'yes'?""" uuids = [ dev_cfg.connection_uuid for dev_cfg in device_configurations.get_all() if dev_cfg.connection_uuid ] for uuid in uuids: ifcfg = get_ifcfg_file([("UUID", uuid)]) if ifcfg: ifcfg.read() if ifcfg.get('ONBOOT') != "no": return True return False
def get_connection_onboot_value(self, uuid): """Gets ONBOOT value of connection given by uuid. The value is stored in ifcfg file because setting the value in NetworkManager connection ('autoconnect') to True could cause activating of the connection. :param uuid: UUID of the connection :return: ONBOOT value """ ifcfg = get_ifcfg_file([('UUID', uuid)]) if not ifcfg: log.error("Can't get ONBOOT value for connection %s", uuid) return False ifcfg.read() return ifcfg.get('ONBOOT') != "no"