fix: wordpress_client init() — CT 101 korrekt finden
- 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
This commit is contained in:
parent
7060618a59
commit
4428730807
1 changed files with 11 additions and 8 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue