feat(updater): support updates after verified SeaweedFS migration
This commit is contained in:
@@ -54,8 +54,10 @@ def identifier(value):
|
||||
def public_state(state):
|
||||
"""An allowlist, never raw command logs, exceptions, host paths, config or diff contents."""
|
||||
result = {"status": state.get("status") if state.get("status") in STATUSES else "idle"}
|
||||
if state.get("phase") in PHASES:
|
||||
result["phase"] = state["phase"]
|
||||
# Host tools are installed before the application update; old backend enums must still parse us.
|
||||
phase = {"checking_storage": "validating", "storage_adopted": "resolved"}.get(state.get("phase"), state.get("phase"))
|
||||
if phase in PHASES:
|
||||
result["phase"] = phase
|
||||
for key in ("recoveryRequired", "maintenance", "mutationStarted"):
|
||||
if key in state:
|
||||
result[key] = bool(state[key])
|
||||
@@ -81,6 +83,9 @@ def public_plan(plan):
|
||||
if type(plan.get("estimatedBackupBytes")) is int:
|
||||
result["estimatedBackupBytes"] = plan["estimatedBackupBytes"]
|
||||
result["retiredServices"] = sorted(set(plan.get("retiredServices", [])) & engine.LEGACY_MATRIX_SERVICES)
|
||||
if plan.get("storageProvider") in ("minio", "seaweedfs"):
|
||||
result["storageProvider"] = plan["storageProvider"]
|
||||
result["storageImageRetained"] = plan.get("storageImageRetained") is True
|
||||
return result
|
||||
|
||||
|
||||
@@ -254,6 +259,11 @@ class Controller:
|
||||
installed = engine.read_json(updater.home / "installed.json", {}).get("manifest", {})
|
||||
result["installed"] = {k: v for k, v in public_state({"version": installed.get("version"),
|
||||
"revision": installed.get("commit")}).items() if k != "status"}
|
||||
storage = engine.read_json(updater.home / "storage-provider.json", {})
|
||||
migration = engine.read_json(updater.home / "storage-migration/state.json", {})
|
||||
if storage.get("provider") == "seaweedfs" or migration.get("writesReleased"):
|
||||
result["storage"] = {"provider": "seaweedfs",
|
||||
"migrationPending": engine.read_json(updater.home / "status.json", {}).get("phase") == "storage_migration"}
|
||||
if self.active:
|
||||
result["request"] = self.request_status(self.active)
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user