[virt-tools-list] [virt-install PATCH v2 5/7] unattended: Take advantage of OsinfoMedia.requires_internet()

Fabiano Fidêncio fidencio at redhat.com
Fri Mar 22 15:23:39 UTC 2019


By using OsinfoMedia.requires_internet() we ensure this logic is not
spread in our codebase and also keep _OsinfoIter internal to osdict.

Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
---
 virtinst/unattended.py | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/virtinst/unattended.py b/virtinst/unattended.py
index da37f2b9..128a8e46 100644
--- a/virtinst/unattended.py
+++ b/virtinst/unattended.py
@@ -16,7 +16,6 @@ from gi.repository import Gio
 from gi.repository import GLib
 
 from . import util
-from .osdict import _OsinfoIter
 
 
 def _make_installconfig(script, osobj, unattended_data, arch, hostname, url):
@@ -234,16 +233,10 @@ 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(os_media):
-        media = os_media.osinfo_media if os_media else None
-        if not media:
+        if not os_media:
             return "network"
 
-        variant_list = list(_OsinfoIter(media.get_os_variants()))
-        for variant in variant_list:
-            if "netinst" in variant.get_id():
-                return "network"
-
-        return "media"
+        return "network" if os_media.requires_internet() else "media"
 
     rawscript = guest.osinfo.get_install_script(unattended_data.profile,
             os_media)
-- 
2.20.1




More information about the virt-tools-list mailing list