[virt-tools-list] [virt-manager PATCH 10/12] unattended: Add method to download drivers
Fabiano Fidêncio
fidencio at redhat.com
Thu Jun 6 14:11:41 UTC 2019
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 at redhat.com>
---
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
--
2.21.0
More information about the virt-tools-list
mailing list