From ea1c4037ae11879b5a9d6af92178eda3df104343 Mon Sep 17 00:00:00 2001 From: Jonh Wendell Date: Wed, 10 Jun 2015 14:44:05 -0300 Subject: [PATCH] apt_proxy: Also consider http error code 406 It seems some Debian versions of apt-cacher-ng return error code 406 instead of 404: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=762969 This is my case in Jessie, for example. This patch considers both codes as "valid". --- bootstrapvz/plugins/apt_proxy/tasks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrapvz/plugins/apt_proxy/tasks.py b/bootstrapvz/plugins/apt_proxy/tasks.py index f6823e5..c813ec4 100644 --- a/bootstrapvz/plugins/apt_proxy/tasks.py +++ b/bootstrapvz/plugins/apt_proxy/tasks.py @@ -18,7 +18,7 @@ class CheckAptProxy(Task): urllib2.urlopen(proxy_url, timeout=5) except Exception as e: # Default response from `apt-cacher-ng` - if isinstance(e, urllib2.HTTPError) and e.code == 404 and e.msg == 'Usage Information': + if isinstance(e, urllib2.HTTPError) and e.code in [404, 406] and e.msg == 'Usage Information': pass else: import logging