1
0
mirror of https://github.com/home-assistant/supervisor.git synced 2025-12-20 02:18:59 +00:00

Make platform parameter required and warn on missing platform

- Make platform a required parameter in get_manifest() and _fetch_manifest()
  since it's always provided by the calling code
- Return None and log warning when requested platform is not found in
  multi-arch manifest list, instead of falling back to first manifest
  which could be the wrong architecture

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Stefan Agner
2025-12-05 15:51:26 +01:00
parent 727d6903a2
commit 1949eb69ba

View File

@@ -182,7 +182,7 @@ class RegistryManifestFetcher:
repository: str,
reference: str,
token: str | None,
platform: str | None = None,
platform: str,
) -> dict | None:
"""Fetch manifest from registry.
@@ -221,11 +221,6 @@ class RegistryManifestFetcher:
_LOGGER.warning("Empty manifest list for %s/%s", registry, repository)
return None
# Find matching platform
target_os = "linux"
target_arch = "amd64" # Default
if platform:
# Platform format is "linux/amd64", "linux/arm64", etc.
parts = platform.split("/")
if len(parts) >= 2:
@@ -242,13 +237,15 @@ class RegistryManifestFetcher:
break
if not platform_manifest:
# Fall back to first manifest
_LOGGER.debug(
"Platform %s/%s not found, using first manifest",
_LOGGER.warning(
"Platform %s/%s not found in manifest list for %s/%s, "
"cannot use manifest for progress tracking",
target_os,
target_arch,
registry,
repository,
)
platform_manifest = manifests[0]
return None
# Fetch the platform-specific manifest
return await self._fetch_manifest(
@@ -265,7 +262,7 @@ class RegistryManifestFetcher:
self,
image: str,
tag: str,
platform: str | None = None,
platform: str,
) -> ImageManifest | None:
"""Fetch manifest and extract layer sizes.