mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-22 13:34:07 +03:00
virtinst: Split out urldetect.py from urlfetcher.py
urldetect.py has all the distro metadata and parsing logic, urlfetcher.py has the http/ftp/iso/etc. fetching logic
This commit is contained in:
parent
6e2e18ccf8
commit
a8522032eb
@ -13,6 +13,7 @@ import unittest
|
||||
from tests import utils
|
||||
|
||||
from virtinst import Guest
|
||||
from virtinst import urldetect
|
||||
from virtinst import urlfetcher
|
||||
from virtinst import util
|
||||
from virtinst.initrdinject import perform_initrd_injections
|
||||
@ -88,7 +89,7 @@ def _fetch_distro(distro):
|
||||
origenv = os.environ.pop("VIRTINST_TEST_SUITE")
|
||||
try:
|
||||
fetcher.prepareLocation()
|
||||
store = urlfetcher.getDistroStore(guest, fetcher)
|
||||
store = urldetect.getDistroStore(guest, fetcher)
|
||||
kernel, initrd, ignore = store.acquireKernel(guest)
|
||||
cleanup.append(kernel)
|
||||
cleanup.append(initrd)
|
||||
|
@ -15,18 +15,19 @@ from tests import utils
|
||||
|
||||
from virtinst import Guest
|
||||
from virtinst import OSDB
|
||||
from virtinst import urldetect
|
||||
from virtinst import urlfetcher
|
||||
from virtinst import util
|
||||
from virtinst.urlfetcher import ALTLinuxDistro
|
||||
from virtinst.urlfetcher import CentOSDistro
|
||||
from virtinst.urlfetcher import DebianDistro
|
||||
from virtinst.urlfetcher import FedoraDistro
|
||||
from virtinst.urlfetcher import GenericDistro
|
||||
from virtinst.urlfetcher import MandrivaDistro
|
||||
from virtinst.urlfetcher import RHELDistro
|
||||
from virtinst.urlfetcher import SLDistro
|
||||
from virtinst.urlfetcher import SuseDistro
|
||||
from virtinst.urlfetcher import UbuntuDistro
|
||||
from virtinst.urldetect import ALTLinuxDistro
|
||||
from virtinst.urldetect import CentOSDistro
|
||||
from virtinst.urldetect import DebianDistro
|
||||
from virtinst.urldetect import FedoraDistro
|
||||
from virtinst.urldetect import GenericDistro
|
||||
from virtinst.urldetect import MandrivaDistro
|
||||
from virtinst.urldetect import RHELDistro
|
||||
from virtinst.urldetect import SLDistro
|
||||
from virtinst.urldetect import SuseDistro
|
||||
from virtinst.urldetect import UbuntuDistro
|
||||
|
||||
|
||||
class _URLTestData(object):
|
||||
@ -51,7 +52,7 @@ class _URLTestData(object):
|
||||
self.testshortcircuit = testshortcircuit
|
||||
|
||||
def _distroclass_for_name(self, name):
|
||||
# Map the test case name to the expected urlfetcher distro
|
||||
# Map the test case name to the expected urldetect distro
|
||||
# class we should be detecting
|
||||
if "fedora" in name:
|
||||
return FedoraDistro
|
||||
@ -110,7 +111,7 @@ def _storeForDistro(fetcher, guest):
|
||||
"""
|
||||
for ignore in range(0, 10):
|
||||
try:
|
||||
return urlfetcher.getDistroStore(guest, fetcher)
|
||||
return urldetect.getDistroStore(guest, fetcher)
|
||||
except Exception as e:
|
||||
if "502" in str(e):
|
||||
logging.debug("Caught proxy error: %s", str(e))
|
||||
|
@ -8,6 +8,7 @@
|
||||
import logging
|
||||
import os
|
||||
|
||||
from . import urldetect
|
||||
from . import urlfetcher
|
||||
from . import util
|
||||
from .devices import DeviceDisk
|
||||
@ -99,7 +100,7 @@ class DistroInstaller(Installer):
|
||||
def _get_store(self, guest, fetcher):
|
||||
# Caller is responsible for calling fetcher prepare/cleanup if needed
|
||||
if not self._cached_store:
|
||||
self._cached_store = urlfetcher.getDistroStore(guest, fetcher)
|
||||
self._cached_store = urldetect.getDistroStore(guest, fetcher)
|
||||
return self._cached_store
|
||||
|
||||
def _prepare_local(self):
|
||||
|
1059
virtinst/urldetect.py
Normal file
1059
virtinst/urldetect.py
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user