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: