Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions release-controller/dre_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,8 @@ def get_blessed_guestos_versions(self) -> set[str]:
# `dre get` forwards its arguments verbatim to `ic-admin`, so the
# output format is dictated by the ic-admin build that matches the
# currently deployed registry canister (downloaded at runtime), not
# by this code. Newer ic-admin releases ignore `--json` for this
# subcommand and print a plain newline-separated list of version IDs;
# older ones wrapped it in {"value": {"blessed_version_ids": [...]}}.
# Accept both so a registry-canister upgrade can't break us again.
# by this code. With the migration away from blessed versions, ic-admin
# has had a few formats. Support all of them here.
output = subprocess.check_output(
[self.cli, "get", "blessed-replica-versions", "--json"],
env=self.env,
Expand All @@ -163,11 +161,18 @@ def get_blessed_guestos_versions(self) -> set[str]:
parsed = json.loads(output)
except json.JSONDecodeError:
parsed = None

# Old format
if isinstance(parsed, dict):
return set(
typing.cast(list[str], parsed["value"]["blessed_version_ids"])
)
return {line.strip() for line in output.splitlines() if line.strip()}
# New format, with --json support
elif isinstance(parsed, list):
return set(parsed)
# New format, without --json support
else:
return {line.strip() for line in output.splitlines() if line.strip()}

def get_blessed_hostos_versions(self) -> set[str]:
"""Query the blessed HostOS versions."""
Expand Down
Loading