On 3/8/19 11:20 AM, Fabiano Fidêncio wrote: > This method returns whether the installer requires or not internet to > perform the installation. > > Signed-off-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx> > --- > 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 > Since this 'netinst' pattern has come up again, I think we should add a wrapper class for the osinfomedia object and hide this logic there, so it isn't sprinkled around. After that_OsinfoIter should be able to stay private to osdict.py too. - Cole _______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list