fix: validate required url/path fields in get_sources
This commit is contained in:
@@ -34,8 +34,12 @@ def get_sources(ansible_cfg: dict) -> list[dict]:
|
|||||||
for src in sources:
|
for src in sources:
|
||||||
src_type = src.get("type", "local")
|
src_type = src.get("type", "local")
|
||||||
if src_type == "git":
|
if src_type == "git":
|
||||||
|
if not src.get("url"):
|
||||||
|
raise ValueError(f"Ansible git source {src['name']!r} is missing required 'url' field")
|
||||||
path = str(Path(cache_dir) / src["name"])
|
path = str(Path(cache_dir) / src["name"])
|
||||||
else:
|
else:
|
||||||
|
if not src.get("path"):
|
||||||
|
raise ValueError(f"Ansible local source {src['name']!r} is missing required 'path' field")
|
||||||
path = src.get("path", "")
|
path = src.get("path", "")
|
||||||
result.append({
|
result.append({
|
||||||
"name": src["name"],
|
"name": src["name"],
|
||||||
|
|||||||
Reference in New Issue
Block a user