virt-manager/9465da41-urlfetcher-Deal-with-file-in-_LocalURLFetcher.patch
Charles Arnold 849b03f9b9 - bsc#1155197 - [xen][virt-manager] Fail to boot up installed
sles15sp2 PV guest
  virtinst-pvgrub2-bootloader.patch
  virtinst-change-location-for-grub_xen.patch
- Upstream bug fixes (bsc#1027942)
  9465da41-urlfetcher-Deal-with-file-in-_LocalURLFetcher.patch
  651e5b6d-devices-video-Simplify-model-hvm-check.patch
  d9736db9-addhardware-Add-bochs-display-to-the-video-list.patch
  8f4c53ea-video-Prefer-bochs-when-its-supported..patch

OBS-URL: https://build.opensuse.org/package/show/Virtualization/virt-manager?expand=0&rev=484
2019-10-28 17:01:55 +00:00

38 lines
1.4 KiB
Diff

Subject: urlfetcher: Deal with 'file://' in _LocalURLFetcher()
From: Fabiano Fidêncio fidencio@redhat.com Tue Sep 24 14:26:43 2019 +0200
Date: Wed Oct 2 11:58:34 2019 -0400:
Git: 9465da4174e778e7607908f18d74fd8aa2cba2fe
osinfo-db may contain files pointing to local paths, which will have the
format 'file:///usr/share/...'.
With the current code, virt-install would just bail as it doesn't
understand the 'file://' schema. Let's start using urllib (which is
already imported in the very same file) and parse the URL so both
'file:///usr/share/...' and '/usr/share/...' would work.
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
diff --git a/virtinst/install/urlfetcher.py b/virtinst/install/urlfetcher.py
index 6084bf01..e52efc8e 100644
--- a/virtinst/install/urlfetcher.py
+++ b/virtinst/install/urlfetcher.py
@@ -365,11 +365,13 @@ class _LocalURLFetcher(_URLFetcher):
For grabbing files from a local directory
"""
def _hasFile(self, url):
- return os.path.exists(url)
+ parsed = urllib.parse.urlparse(url)
+ return os.path.exists(parsed.path)
def _grabber(self, url):
- urlobj = open(url, "rb")
- size = os.path.getsize(url)
+ parsed = urllib.parse.urlparse(url)
+ urlobj = open(parsed.path, "rb")
+ size = os.path.getsize(parsed.path)
return urlobj, size