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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list




[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux