fix(containers): fall back to image tag when version metadata is empty
This commit is contained in:
@@ -47,6 +47,10 @@ func InstallContainer(ctx context.Context, item types.RegistryContainer) error {
|
||||
}
|
||||
|
||||
// 2.5. Persist install metadata so installed-but-not-running state can be tracked without Docker lookups
|
||||
// The version is required for update detection; fall back to the image tag when the payload omitted it.
|
||||
if item.Version == "" {
|
||||
item.Version = imageTag(item.Image)
|
||||
}
|
||||
metadata := types.InstalledMetadata{
|
||||
RegistryContainer: item,
|
||||
InstalledAt: time.Now().UTC().Format(time.RFC3339),
|
||||
|
||||
@@ -37,6 +37,12 @@ func (cache *ContainerCache) LoadInstalledContainers() error {
|
||||
continue
|
||||
}
|
||||
|
||||
// Older install records left the version empty; fall back to the image tag
|
||||
// so update detection has something to compare against.
|
||||
if metadata.Version == "" {
|
||||
metadata.Version = imageTag(metadata.Image)
|
||||
}
|
||||
|
||||
cache.AddService(types.Container{
|
||||
ServiceName: name,
|
||||
Name: metadata.Name,
|
||||
|
||||
Reference in New Issue
Block a user