On 6/6/19 10:11 AM, Fabiano Fidêncio wrote: > This will be used by unattended installations. The drivers are > downloaded in the very same directory where the unattended files are > generated. > > Signed-off-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx> > --- > virtinst/unattended.py | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/virtinst/unattended.py b/virtinst/unattended.py > index 7a62dc9c..573289c2 100644 > --- a/virtinst/unattended.py > +++ b/virtinst/unattended.py > @@ -8,6 +8,7 @@ > > import logging > import os > +import requests > > import gi > gi.require_version('Libosinfo', '1.0') > @@ -270,3 +271,18 @@ def generate_install_script(script): > cmdline = script.generate_cmdline() > > return path, cmdline > + > + > +def download_drivers(locations): > + drivers = [] > + > + scratch = util.make_unattended_cache_dir() > + for location in locations: > + filename = location.rsplit('/', 1)[1] > + path = os.path.join(scratch, filename) > + logging.debug("Downloading %s", path) > + r = requests.get(location) > + open(path, 'wb').write(r.content) > + drivers.append(path) > + > + return drivers > Since this is using requests, I'd rather find a way to reuse the urlfetcher.py support, which can receive a passed in 'meter' and do cli download progress reporting, and already handles saving to a tempfile - Cole _______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list