[virt-tools-list] [virt-install PATCH v2 3/7] osdict: Add requires_internet() to OsMedia

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


In order to properly do a unattended installation of some medias (as net
installers), we have to check whether the media requires or not
internet. Doing so by checking its variant is not the most beautiful way
(as variants do not have a set of predefined names), but that's the best
that can be done with the current state of osinfo-db.

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

diff --git a/virtinst/osdict.py b/virtinst/osdict.py
index 6486643d..67e70f62 100644
--- a/virtinst/osdict.py
+++ b/virtinst/osdict.py
@@ -616,3 +616,11 @@ class _OsVariant(object):
 class OsMedia(object):
     def __init__(self, osinfo_media):
         self.osinfo_media = osinfo_media
+
+    def requires_internet(self):
+        if self.osinfo_media:
+            variants = list(_OsinfoIter(self.osinfo_media.get_os.variants()))
+            for variant in variants:
+                if "netinst" in variant.get_id():
+                    return True
+        return False
-- 
2.20.1




More information about the virt-tools-list mailing list