osdict: Add _get_{pre,post}_installable_drivers()

Let's add two new *private* methods to get the pre & post installable
drivers, returning a list of OsinfoDeviceDrivers;

Those are going to be used later on this series in order to get the
drivers' locations.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
This commit is contained in:
Fabiano Fidêncio 2019-07-30 17:57:15 +02:00 committed by Cole Robinson
parent 3009888a0e
commit 8ab2e49e36
1 changed files with 33 additions and 0 deletions

View File

@ -646,6 +646,39 @@ class _OsVariant(object):
return [] # pragma: no cover
return list(_OsinfoIter(self._os.get_install_script_list()))
def _get_installable_drivers(self, arch):
if not self._os:
return []
installable_drivers = []
device_drivers = list(_OsinfoIter(self._os.get_device_drivers()))
for device_driver in device_drivers:
if arch != "all" and device_driver.get_architecture() != arch:
continue
installable_drivers.append(device_driver)
return installable_drivers
def _get_pre_installable_drivers(self, arch):
installable_drivers = self._get_installable_drivers(arch)
pre_inst_drivers = []
for driver in installable_drivers:
if not driver.get_pre_installable():
continue
pre_inst_drivers.append(driver)
return pre_inst_drivers
def _get_post_installable_drivers(self, arch):
installable_drivers = self._get_installable_drivers(arch)
post_inst_drivers = []
for driver in installable_drivers:
if driver.get_pre_installable():
continue
post_inst_drivers.append(driver)
return post_inst_drivers
class _OsMedia(object):
def __init__(self, osinfo_media):