From 519ecd600b912140ac8112b7a0cbec103447ed74 Mon Sep 17 00:00:00 2001 From: "Sverre H. Huseby" Date: Mon, 12 Jun 2023 12:50:54 +0200 Subject: [PATCH] Make refresh_schemas handle firewalls that cut the file transfer midway (#3546) Co-authored-by: Sverre H. Huseby --- src/ansiblelint/schemas/__main__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ansiblelint/schemas/__main__.py b/src/ansiblelint/schemas/__main__.py index 23777cae3a..e3ec8ae600 100644 --- a/src/ansiblelint/schemas/__main__.py +++ b/src/ansiblelint/schemas/__main__.py @@ -7,6 +7,7 @@ import urllib.request from collections import defaultdict from functools import cache +from http.client import HTTPException from pathlib import Path from typing import Any from urllib.request import Request @@ -88,7 +89,7 @@ def refresh_schemas(min_age_seconds: int = 3600 * 24) -> int: # unload possibly loaded schema if kind in _schema_cache: # pragma: no cover del _schema_cache[kind] - except (ConnectionError, OSError) as exc: + except (ConnectionError, OSError, HTTPException) as exc: if ( isinstance(exc, urllib.error.HTTPError) and getattr(exc, "code", None) == 304