From 3814d6366672ad9d1e4bfedb153f6e9196b27fad Mon Sep 17 00:00:00 2001 From: Steve Langasek Date: Fri, 1 Oct 2021 12:13:57 -0700 Subject: [PATCH] Make download_retry work with non-HTTP urls urlopen() supports non-http URLs, but when called on them, http-related features are absent - such as getcode(). Make the code work with file:/// URLs. --- britney2/policies/autopkgtest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/britney2/policies/autopkgtest.py b/britney2/policies/autopkgtest.py index 20452bf..700ebef 100644 --- a/britney2/policies/autopkgtest.py +++ b/britney2/policies/autopkgtest.py @@ -807,7 +807,7 @@ class AutopkgtestPolicy(BasePolicy): try: req = urlopen(url, timeout=30) code = req.getcode() - if 200 <= code < 300: + if not code or 200 <= code < 300: return req except socket.timeout as e: self.logger.info(