From 44287308074a666fbc1b8de7f8f9c4bd47041711 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 9 Mar 2026 13:13:08 +0700 Subject: [PATCH] =?UTF-8?q?fix:=20wordpress=5Fclient=20init()=20=E2=80=94?= =?UTF-8?q?=20CT=20101=20korrekt=20finden?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Filter auf vmid==101 UND host=='pve-hetzner' (eindeutig) - Passwort aus PW_WP_ADMIN in cfg.raw - check_connectivity() prüft WP_URL/WP_PASSWORD vor Request Made-with: Cursor --- homelab-ai-bot/core/wordpress_client.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/homelab-ai-bot/core/wordpress_client.py b/homelab-ai-bot/core/wordpress_client.py index d7346052..d48aef36 100644 --- a/homelab-ai-bot/core/wordpress_client.py +++ b/homelab-ai-bot/core/wordpress_client.py @@ -16,23 +16,24 @@ def init(cfg): ct_101 = None for c in cfg.containers: - if c.vmid == 101: + if c.vmid == 101 and c.host == "pve-hetzner": ct_101 = c break - if not ct_101: + if not ct_101 or not ct_101.tailscale_ip: return False - # WordPress erreichbar über Tailscale IP oder Domain + # WordPress erreichbar über Tailscale IP WP_URL = f"http://{ct_101.tailscale_ip}" WP_USER = "admin" - WP_PASSWORD = cfg.passwords.get("wordpress_admin", "") - if not WP_PASSWORD: - # Fallback: aus raw config - WP_PASSWORD = cfg.raw.get("PW_WP_ADMIN", "") + # Passwort aus config + pw = cfg.raw.get("PW_WP_ADMIN", "") + if pw: + WP_PASSWORD = pw + return True - return bool(WP_PASSWORD) + return False def _request(endpoint: str, method: str = "GET", params: dict = None) -> Optional[dict]: @@ -56,6 +57,8 @@ def _request(endpoint: str, method: str = "GET", params: dict = None) -> Optiona def check_connectivity() -> bool: """Ist WordPress erreichbar?""" try: + if not WP_URL or not WP_PASSWORD: + return False result = _request("/posts?per_page=1") return result is not None except: