installer: Clean up unattended preinstall drivers

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2019-10-02 11:27:19 -04:00
parent b6e4e4538d
commit 355d7fed80
2 changed files with 11 additions and 6 deletions

View File

@ -234,8 +234,8 @@ class Installer(object):
guest.os.arch)
drivers = unattended.download_drivers(drivers_location,
InstallerTreeMedia.make_scratchdir(guest), meter)
if drivers:
injections.extend(drivers)
self._tmpfiles.extend([driverpair[0] for driverpair in drivers])
iso = perform_cdrom_injections(injections,
InstallerTreeMedia.make_scratchdir(guest))

View File

@ -376,9 +376,14 @@ def download_drivers(locations, scratchdir, meter):
drivers = []
try:
for location in locations:
filename = location.rsplit('/', 1)[1]
driver = fetcher.acquireFile(location)
drivers.append((driver, filename))
except Exception: # pragma: no cover
for driverpair in drivers:
os.unlink(driverpair[0])
raise
return drivers