File virtinst-ignore-error-403-on-directories.patch of Package virt-manager

bnc#892821

Ignore HTTP error 403 if the location is a directory. This allows
the OS detection procedure to succeed when Indexes are disabled
on the HTTP server.

Index: virt-manager-1.0.1/virtinst/urlfetcher.py
===================================================================
--- virt-manager-1.0.1.orig/virtinst/urlfetcher.py
+++ virt-manager-1.0.1/virtinst/urlfetcher.py
@@ -140,8 +140,11 @@ class _HTTPImageFetcher(_URIImageFetcher
             request.get_method = lambda: "HEAD"
             urllib2.urlopen(request)
         except Exception, e:
-            logging.debug("HTTP hasFile: didn't find %s: %s", path, str(e))
-            return False
+            if path.endswith("/") and e.code == 403:
+                logging.debug("HTTP hasFile: indexing disabled in %s?.", path)
+            else:
+                logging.debug("HTTP hasFile: didn't find %s: %s", path, str(e))
+                return False
         return True
 
 
openSUSE Build Service is sponsored by