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
|
// 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{
|
metadata := types.InstalledMetadata{
|
||||||
RegistryContainer: item,
|
RegistryContainer: item,
|
||||||
InstalledAt: time.Now().UTC().Format(time.RFC3339),
|
InstalledAt: time.Now().UTC().Format(time.RFC3339),
|
||||||
|
|||||||
@@ -37,6 +37,12 @@ func (cache *ContainerCache) LoadInstalledContainers() error {
|
|||||||
continue
|
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{
|
cache.AddService(types.Container{
|
||||||
ServiceName: name,
|
ServiceName: name,
|
||||||
Name: metadata.Name,
|
Name: metadata.Name,
|
||||||
|
|||||||
Reference in New Issue
Block a user