[virt-tools-list] [virt-install PATCH 2/4] installertreemedia: Add requires_internet()

Fabiano Fidêncio fidencio at redhat.com
Fri Mar 8 16:20:57 UTC 2019


This method returns whether the installer requires or not internet to
perform the installation.

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

diff --git a/virtinst/installertreemedia.py b/virtinst/installertreemedia.py
index 86792503..f8ff1b1b 100644
--- a/virtinst/installertreemedia.py
+++ b/virtinst/installertreemedia.py
@@ -14,7 +14,7 @@ from . import util
 from .devices import DeviceDisk
 from .initrdinject import perform_initrd_injections
 from .kernelupload import upload_kernel_initrd
-from .osdict import OSDB
+from .osdict import OSDB, _OsinfoIter
 
 
 # Enum of the various install media types we can have
@@ -232,3 +232,13 @@ class InstallerTreeMedia(object):
         fetcher = self._get_fetcher(guest, None)
         cache = self._get_cached_data(guest, fetcher)
         return cache.os_variant
+
+    def requires_internet(self):
+        if self._media_type in [MEDIA_URL, MEDIA_DIR]:
+            return True
+        if self._media:
+            variant_list = list(_OsinfoIter(self._media.get_os_variants()))
+            for variant in variant_list:
+                if "netinst" in variant.get_id():
+                    return True
+        return False
-- 
2.20.1




More information about the virt-tools-list mailing list