[virt-tools-list] [PATCH] URL installs: remove hasFile("") check

Cole Robinson crobinso at redhat.com
Wed Dec 10 18:58:23 UTC 2014


On 12/10/2014 01:49 PM, Cole Robinson wrote:
> On 12/08/2014 04:43 PM, Gabriel de Perthuis wrote:
>> Specialised proxies like apt-cacher-ng disallow directory listing.
>> OSDistro subclasses do have checks for known files and they are
>> sufficient.
>> ---
>>   virtinst/urlfetcher.py | 5 -----
>>   1 file changed, 5 deletions(-)
>>
>> diff --git a/virtinst/urlfetcher.py b/virtinst/urlfetcher.py
>> index 5a8a98d..25f7066 100644
>> --- a/virtinst/urlfetcher.py
>> +++ b/virtinst/urlfetcher.py
>> @@ -125,15 +125,10 @@ class _URIImageFetcher(_ImageFetcher):
>>       Base class for downloading from FTP / HTTP
>>       """
>>       def hasFile(self, filename):
>>           raise NotImplementedError
>>
>> -    def prepareLocation(self):
>> -        if not self.hasFile(""):
>> -            raise ValueError(_("Opening URL %s failed.") %
>> -                              (self.location))
>> -
>>
>>   class _HTTPImageFetcher(_URIImageFetcher):
>>       def hasFile(self, filename):
>>           try:
>>               path = self._make_path(filename)
>>
>
> I always liked that it bails immediately if the URL is mistyped, but we've had
> enough complaints over the years about this, so I've pushed your patch. Thanks
> for the contribution!
>

FWIW a follow up commit to try and hint at the user if the URL appears 
inaccessible and detection failed. Shouldn't break your use case though:

commit 6871ee0c91e0f55c84904cad47f0b26779a5f244
Author: Cole Robinson <crobinso at redhat.com>
Date:   Wed Dec 10 13:57:10 2014 -0500

     urlfetcher: Hint at the user if URL appears unaccessible

- Cole




More information about the virt-tools-list mailing list