summaryrefslogtreecommitdiffstats
path: root/src/ansiblelint/schemas/__main__.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/ansiblelint/schemas/__main__.py')
-rw-r--r--src/ansiblelint/schemas/__main__.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/ansiblelint/schemas/__main__.py b/src/ansiblelint/schemas/__main__.py
index e3ec8ae..e216c0b 100644
--- a/src/ansiblelint/schemas/__main__.py
+++ b/src/ansiblelint/schemas/__main__.py
@@ -1,4 +1,5 @@
"""Module containing cached JSON schemas."""
+
import json
import logging
import os
@@ -68,7 +69,10 @@ def refresh_schemas(min_age_seconds: int = 3600 * 24) -> int:
raise RuntimeError(msg)
path = Path(__file__).parent.resolve() / f"{kind}.json"
_logger.debug("Refreshing %s schema ...", kind)
- request = Request(url)
+ if not url.startswith(("http:", "https:")):
+ msg = f"Unexpected url schema: {url}"
+ raise ValueError(msg)
+ request = Request(url) # noqa: S310
etag = data.get("etag", "")
if etag:
request.add_header("If-None-Match", f'"{data.get("etag")}"')
@@ -108,7 +112,6 @@ def refresh_schemas(min_age_seconds: int = 3600 * 24) -> int:
get_schema.cache_clear()
else:
store_file.touch()
- changed = 1
return changed