mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-09-29 18:16:43 +00:00
OCI manager Apps - App tab: containers installed from an OCI image are identified from their installation record; the application and image versions are shown and an update is detected by image digest; repository link; Refresh data. - Updates tab for OCI containers: Update and Recreate run the same flow as the OCI menu in the Monitor terminal; the pre-update backup can be kept in a backup storage; scheduled image updates with an optional minimum age. - Logs tab: console output of the application, kept on the host (lxc.console.logfile + logrotate) and followed live. - The Proxmox console opens a shell (cmode: shell) when the image has one. - A damaged image download is fetched again before failing. - Multi-container applications open at their LAN address; volume mount points on block storage report their usage. Monitor - Proxmox notifications are delivered to a loopback-only HTTP listener when HTTPS is enabled, so they no longer fail certificate verification. - Log persistence counts recurring patterns only; an ended burst is not reported as persistent and its warning clears on its own (#386). - Proxmox notification config backups are deduplicated and capped at three. - The update icon on the Apps page opens the container on its Updates tab. - Version 1.2.6.2-beta and its release notes in every Monitor language. Docs - OCI manager Apps and Audit & Report rebuilt as per-page message files, with a new page for OCI containers in the Monitor. - Seven pages fixed where rich-text tags were missing from t.rich. Translations - Spanish fixes across the OCI engine, the Monitor and the TUI menus. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
63 lines
2.2 KiB
Python
63 lines
2.2 KiB
Python
"""What the VM & LXC modal needs to know about an OCI instance.
|
|
|
|
Read-only view of the installation record OCI manager Apps keeps for every
|
|
container it created: whether the container is one, whether it belongs to a
|
|
multi-container application, whether it uses host directories (which its
|
|
backup does not revert) and whether an operation is pending. Nothing here
|
|
changes the record or runs inside the container.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import os
|
|
|
|
import oci_console_logs
|
|
|
|
ROOT = "/usr/local/share/proxmenux/oci/instances"
|
|
|
|
|
|
def _record(vmid: int) -> dict | None:
|
|
path = os.path.join(ROOT, str(int(vmid)), "oci-compose.json")
|
|
try:
|
|
with open(path, encoding="utf-8") as handle:
|
|
record = json.load(handle)
|
|
except (OSError, ValueError):
|
|
return None
|
|
return record if isinstance(record, dict) else None
|
|
|
|
|
|
def _host_dirs(record: dict) -> bool:
|
|
mounts = (record.get("deployment") or {}).get("mounts") or []
|
|
return any(isinstance(m, dict) and m.get("type") == "host-bind" for m in mounts)
|
|
|
|
|
|
def info(vmid: int) -> dict:
|
|
vmid = int(vmid)
|
|
result = {
|
|
"vmid": vmid,
|
|
"oci_instance": False,
|
|
"console_log": oci_console_logs.configured_log(vmid) is not None,
|
|
"stack": False,
|
|
"primary_vmid": vmid,
|
|
"members": [],
|
|
"host_directories": False,
|
|
"pending": False,
|
|
}
|
|
record = _record(vmid)
|
|
if record is None:
|
|
return result
|
|
primary_id = int((record.get("stack_member") or {}).get("primary_vmid") or vmid)
|
|
primary = record if primary_id == vmid else (_record(primary_id) or {})
|
|
members = [int(m["vmid"]) for m in (primary.get("stack") or {}).get("members") or []
|
|
if isinstance(m, dict) and str(m.get("vmid", "")).isdigit()]
|
|
records = [record] if not members else [r for r in (_record(m) for m in members) if r]
|
|
result.update(
|
|
oci_instance=True,
|
|
stack=bool(members) or bool(record.get("stack_member")),
|
|
primary_vmid=primary_id,
|
|
members=members,
|
|
host_directories=any(_host_dirs(r) for r in records),
|
|
pending=bool(record.get("pending_transaction") or primary.get("pending_stack_transaction")),
|
|
)
|
|
return result
|