diff --git a/virtinst/install/installer.py b/virtinst/install/installer.py index e3cf05de4..6fa0d40a4 100644 --- a/virtinst/install/installer.py +++ b/virtinst/install/installer.py @@ -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) + injections.extend(drivers) + self._tmpfiles.extend([driverpair[0] for driverpair in drivers]) iso = perform_cdrom_injections(injections, InstallerTreeMedia.make_scratchdir(guest)) diff --git a/virtinst/install/unattended.py b/virtinst/install/unattended.py index 1fb73d034..c637ab573 100644 --- a/virtinst/install/unattended.py +++ b/virtinst/install/unattended.py @@ -376,9 +376,14 @@ def download_drivers(locations, scratchdir, meter): drivers = [] - for location in locations: - filename = location.rsplit('/', 1)[1] - driver = fetcher.acquireFile(location) - drivers.append((driver, filename)) + 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