fix(awooop): add read-only 188 ansible check-mode
Some checks failed
Ansible Lint / lint (push) Successful in 32s
CD Pipeline / tests (push) Successful in 1m16s
Code Review / ai-code-review (push) Successful in 14s
CD Pipeline / build-and-deploy (push) Has been cancelled
CD Pipeline / post-deploy-checks (push) Has been cancelled

This commit is contained in:
Your Name
2026-05-31 14:59:37 +08:00
parent e8bf5ba55c
commit f615ac506e
4 changed files with 114 additions and 4 deletions

View File

@@ -62,6 +62,7 @@ _CATALOG: tuple[dict[str, Any], ...] = (
{
"catalog_id": "ansible:188-ai-web",
"playbook_path": "infra/ansible/playbooks/188-ai-web.yml",
"check_mode_playbook_path": "infra/ansible/playbooks/188-ai-web-readonly.yml",
"inventory_hosts": ["host_188"],
"domains": ["docker", "momo_backup", "signoz", "minio", "litellm", "n8n", "open_webui", "nginx"],
"keywords": [
@@ -233,6 +234,7 @@ def _catalog_hints(incident: dict[str, Any] | None, drift: dict[str, Any] | None
"inventory_hosts",
"domains",
"supports_check_mode",
"check_mode_playbook_path",
"auto_apply_enabled",
"approval_required",
"risk_level",
@@ -347,6 +349,7 @@ def build_ansible_decision_audit_payload(
{
"catalog_id": row["catalog_id"],
"playbook_path": row["playbook_path"],
"check_mode_playbook_path": row.get("check_mode_playbook_path"),
"inventory_hosts": row["inventory_hosts"],
"supports_check_mode": row["supports_check_mode"],
"auto_apply_enabled": row["auto_apply_enabled"],

View File

@@ -161,8 +161,14 @@ def _safe_candidate(input_payload: dict[str, Any]) -> dict[str, Any]:
continue
if catalog_item.get("auto_apply_enabled") is True:
continue
playbook_path = str(candidate.get("playbook_path") or catalog_item.get("playbook_path") or "")
if playbook_path != str(catalog_item.get("playbook_path") or ""):
catalog_playbook_path = str(catalog_item.get("playbook_path") or "")
candidate_playbook_path = str(candidate.get("playbook_path") or catalog_playbook_path)
check_mode_playbook_path = str(
candidate.get("check_mode_playbook_path")
or catalog_item.get("check_mode_playbook_path")
or catalog_playbook_path
)
if candidate_playbook_path not in {catalog_playbook_path, check_mode_playbook_path}:
continue
inventory_hosts = candidate.get("inventory_hosts") or catalog_item.get("inventory_hosts") or []
if (
@@ -172,7 +178,10 @@ def _safe_candidate(input_payload: dict[str, Any]) -> dict[str, Any]:
):
return {
"catalog_id": catalog_id,
"playbook_path": playbook_path,
"playbook_path": check_mode_playbook_path,
"catalog_playbook_path": catalog_playbook_path,
"source_candidate_playbook_path": candidate_playbook_path,
"check_mode_playbook_path": check_mode_playbook_path,
"inventory_hosts": tuple(inventory_hosts),
"risk_level": str(candidate.get("risk_level") or catalog_item.get("risk_level") or ""),
}
@@ -199,6 +208,9 @@ def build_ansible_check_mode_claim_input(
"source_candidate_op_id": source_candidate_op_id,
"catalog_id": safe["catalog_id"],
"playbook_path": safe["playbook_path"],
"catalog_playbook_path": safe["catalog_playbook_path"],
"source_candidate_playbook_path": safe["source_candidate_playbook_path"],
"check_mode_playbook_path": safe["check_mode_playbook_path"],
"inventory_hosts": list(safe["inventory_hosts"]),
"risk_level": safe["risk_level"],
}