feat: implement session management and terminal handling with UI updates and backend support
This commit is contained in:
+10
-2
@@ -89,6 +89,11 @@ check_python
|
||||
"""
|
||||
|
||||
|
||||
# The original v4 template shipped this exact agent without an ownership
|
||||
# manifest. Recognize that payload when creating from a cached v4 template.
|
||||
_V4_TEMPLATE_AGENT_SHA256 = "dfdd4bd6ee3dc06fbdbda6402cb2c54921cff22190d8da889209559800f8b948"
|
||||
|
||||
|
||||
def guest_agent_files() -> dict[str, bytes]:
|
||||
"""The same standalone payload is used by the builder and offline upgrades."""
|
||||
return {
|
||||
@@ -283,7 +288,7 @@ class ImageStore:
|
||||
)
|
||||
if marker is None or marker.path.read_text(encoding="utf-8") not in {
|
||||
"uvm-ubuntu-jammy-v1\n", "uvm-ubuntu-jammy-v2\n", "uvm-ubuntu-jammy-v3\n",
|
||||
"uvm-ubuntu-jammy-v4\n",
|
||||
"uvm-ubuntu-jammy-v4\n", "uvm-ubuntu-jammy-v5\n",
|
||||
}:
|
||||
return None
|
||||
profile = self._read_guest_file(
|
||||
@@ -374,7 +379,10 @@ class ImageStore:
|
||||
existing = self._agent_file(disk, path, files / f"existing-{index}")
|
||||
if existing is not None:
|
||||
digest = hashlib.sha256(existing.path.read_bytes()).hexdigest()
|
||||
if digest not in {hashes[path], old_hashes.get(path)}:
|
||||
allowed = {hashes[path], old_hashes.get(path)}
|
||||
if not old_hashes and path == "/usr/lib/uvm/agent.py":
|
||||
allowed.add(_V4_TEMPLATE_AGENT_SHA256)
|
||||
if digest not in allowed:
|
||||
raise UvmError(f"refusing to overwrite a customized guest agent file: {path}")
|
||||
source = files / f"payload-{index}"
|
||||
source.write_bytes(content)
|
||||
|
||||
Reference in New Issue
Block a user