mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-11-02 10:52:22 +00:00
fix(monitor): handle a PBS on the same host and complete the PBS views
- Open a PBS installed on this host on the address in use, without probing it - Never carry or offer localhost addresses between Monitors - Read the PBS of a PVE+PBS host in Backup Server, with its hostname and version - Offer the PBS storages without a connection, with address and fingerprint - Show the disks and pools of a PBS in its Datastores tab - Hide guest and PVE storage settings on a PBS - Show a clearer status line for a PBS
This commit is contained in:
@@ -24,11 +24,30 @@ def platform():
|
||||
@require_auth
|
||||
def servers():
|
||||
try:
|
||||
return jsonify(servers=pbs.public_servers(), local_available=pbs.is_pbs_host())
|
||||
servers = pbs.public_servers()
|
||||
return jsonify(servers=servers, local_available=pbs.local_available(), detected=_detected(servers))
|
||||
except pbs.PBSError as exc:
|
||||
return jsonify(error=str(exc)), 500
|
||||
|
||||
|
||||
def _detected(servers):
|
||||
"""PBS storages of this PVE that have no monitoring connection yet."""
|
||||
if pbs.is_pbs_host():
|
||||
return []
|
||||
import monitor_links
|
||||
from urllib.parse import urlsplit
|
||||
known = {urlsplit(row.get("url", "")).hostname for row in servers}
|
||||
found = {}
|
||||
for row in monitor_links._storage_pbs():
|
||||
host = row["server"]
|
||||
if host in known or monitor_links._is_this_host(host):
|
||||
continue
|
||||
port = row.get("port") if str(row.get("port", "")).isdigit() else monitor_links.PBS_UI_PORT
|
||||
url = monitor_links._host_url(host, port, "https")
|
||||
found.setdefault(url, {"name": row["name"], "url": url, "fingerprint": row.get("fingerprint", "")})
|
||||
return list(found.values())
|
||||
|
||||
|
||||
def _protected_configuration():
|
||||
local = auth_manager.load_auth_config()
|
||||
return local.get("enabled") and not local.get("declined") and local.get("password_hash")
|
||||
|
||||
Reference in New Issue
Block a user