mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-03-08 04:58:29 +03:00
urldetect: return osdict.py:OsMedia instead of Libosinfo.Media
Consequently, let's: - rename urldetect::get_osinfo_media() to get_os_media() - rename the installertreemedia::_LocationData::osinfo_media to os_media - rename unattended::prepare_install_script's media argument to os_media - and also rename media to os_media on its internal _get_installation_source() method - rename osdict::get_install_script's media argument to os_media Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
This commit is contained in:
parent
313a95bd8e
commit
467cb9bc0a
@ -30,10 +30,10 @@ def _is_url(url):
|
||||
|
||||
|
||||
class _LocationData(object):
|
||||
def __init__(self, os_variant, kernel_pairs, osinfo_media):
|
||||
def __init__(self, os_variant, kernel_pairs, os_media):
|
||||
self.os_variant = os_variant
|
||||
self.kernel_pairs = kernel_pairs
|
||||
self.osinfo_media = osinfo_media
|
||||
self.os_media = os_media
|
||||
|
||||
self.kernel_url_arg = None
|
||||
if self.os_variant:
|
||||
@ -124,18 +124,18 @@ class InstallerTreeMedia(object):
|
||||
skip_error=has_location_kernel)
|
||||
|
||||
os_variant = None
|
||||
osinfo_media = None
|
||||
os_media = None
|
||||
kernel_paths = []
|
||||
if store:
|
||||
kernel_paths = store.get_kernel_paths()
|
||||
os_variant = store.get_osdict_info()
|
||||
osinfo_media = store.get_osinfo_media()
|
||||
os_media = store.get_os_media()
|
||||
if has_location_kernel:
|
||||
kernel_paths = [
|
||||
(self._location_kernel, self._location_initrd)]
|
||||
|
||||
self._cached_data = _LocationData(os_variant, kernel_paths,
|
||||
osinfo_media)
|
||||
os_media)
|
||||
return self._cached_data
|
||||
|
||||
def _prepare_kernel_url(self, guest, fetcher):
|
||||
@ -185,7 +185,7 @@ class InstallerTreeMedia(object):
|
||||
if self._unattended_data:
|
||||
location = self.location if self._media_type == MEDIA_URL else None
|
||||
script = unattended.prepare_install_script(
|
||||
guest, self._unattended_data, location, cache.osinfo_media)
|
||||
guest, self._unattended_data, location, cache.os_media)
|
||||
path, cmdline = unattended.generate_install_script(script)
|
||||
|
||||
logging.debug("Generated unattended cmdline: %s", cmdline)
|
||||
|
@ -569,7 +569,7 @@ class _OsVariant(object):
|
||||
_("OS '%s' does not have a URL location for the %s architecture") %
|
||||
(self.name, arch))
|
||||
|
||||
def get_install_script(self, profile, media=None):
|
||||
def get_install_script(self, profile, os_media=None):
|
||||
def _get_install_script(script_list):
|
||||
if not script_list:
|
||||
raise RuntimeError(
|
||||
@ -601,6 +601,7 @@ class _OsVariant(object):
|
||||
|
||||
# In case we're dealing with a media installation, let's try to get
|
||||
# the installer scripts from the media, in case any is set.
|
||||
media = os_media.osinfo_media if os_media else None
|
||||
if media:
|
||||
if not media.supports_installer_script():
|
||||
raise RuntimeError(
|
||||
|
@ -230,10 +230,11 @@ class UnattendedData():
|
||||
user_password = None
|
||||
|
||||
|
||||
def prepare_install_script(guest, unattended_data, url=None, media=None):
|
||||
def prepare_install_script(guest, unattended_data, url=None, os_media=None):
|
||||
# This is ugly, but that's only the current way to deal with netinstall
|
||||
# medias.
|
||||
def _get_installation_source(media):
|
||||
def _get_installation_source(os_media):
|
||||
media = os_media.osinfo_media if os_media else None
|
||||
if not media:
|
||||
return "network"
|
||||
|
||||
@ -244,14 +245,15 @@ def prepare_install_script(guest, unattended_data, url=None, media=None):
|
||||
|
||||
return "media"
|
||||
|
||||
rawscript = guest.osinfo.get_install_script(unattended_data.profile, media)
|
||||
rawscript = guest.osinfo.get_install_script(unattended_data.profile,
|
||||
os_media)
|
||||
script = OSInstallScript(rawscript, guest.osinfo)
|
||||
|
||||
# For all tree based installations we're going to perform initrd injection
|
||||
# and install the systems via network.
|
||||
script.set_preferred_injection_method("initrd")
|
||||
|
||||
installationsource = _get_installation_source(media)
|
||||
installationsource = _get_installation_source(os_media)
|
||||
script.set_installation_source(installationsource)
|
||||
|
||||
config = _make_installconfig(script, guest.osinfo, unattended_data,
|
||||
|
@ -8,7 +8,7 @@ import configparser
|
||||
import logging
|
||||
import re
|
||||
|
||||
from .osdict import OSDB
|
||||
from .osdict import OSDB, OsMedia
|
||||
|
||||
|
||||
###############################################
|
||||
@ -383,11 +383,11 @@ class _DistroTree(object):
|
||||
"""
|
||||
return self._os_variant
|
||||
|
||||
def get_osinfo_media(self):
|
||||
def get_os_media(self):
|
||||
"""
|
||||
Return detected libosinfo media object
|
||||
Return an OsMedia wrapper around the detected libosinfo media object
|
||||
"""
|
||||
return self.cache.libosinfo_mediaobj
|
||||
return OsMedia(self.cache.libosinfo_mediaobj)
|
||||
|
||||
|
||||
class _FedoraDistro(_DistroTree):
|
||||
|
Loading…
x
Reference in New Issue
Block a user