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