image: remove leftover LCOW platform checks
This removes some of the checks that were added in 0cba7740d4
,
but should no longer be needed.
- `image/store.Delete()`: no need to validate image platform to delete it.
- `image/tarexporter/takeLayerReference()`: use `image.OperatingSystem()` and
fail early to prevent constructing the `ChainID()`.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
b2ef2e8c83
commit
1ef0a5bb91
2 changed files with 4 additions and 12 deletions
|
@ -229,13 +229,10 @@ func (is *store) Delete(id ID) ([]layer.Metadata, error) {
|
|||
if imageMeta == nil {
|
||||
return nil, fmt.Errorf("unrecognized image ID %s", id.String())
|
||||
}
|
||||
img, err := is.Get(id)
|
||||
_, err := is.Get(id)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unrecognized image %s, %v", id.String(), err)
|
||||
}
|
||||
if !system.IsOSSupported(img.OperatingSystem()) {
|
||||
return nil, fmt.Errorf("unsupported image operating system %q", img.OperatingSystem())
|
||||
}
|
||||
for id := range imageMeta.children {
|
||||
is.fs.DeleteMetadata(id.Digest(), "parent")
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ import (
|
|||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"github.com/docker/distribution"
|
||||
|
@ -149,18 +148,14 @@ func (l *tarexporter) takeLayerReference(id image.ID, imgDescr *imageDescriptor)
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if os := img.OperatingSystem(); !system.IsOSSupported(os) {
|
||||
return fmt.Errorf("os %q is not supported", os)
|
||||
}
|
||||
imgDescr.image = img
|
||||
topLayerID := img.RootFS.ChainID()
|
||||
if topLayerID == "" {
|
||||
return nil
|
||||
}
|
||||
os := img.OS
|
||||
if os == "" {
|
||||
os = runtime.GOOS
|
||||
}
|
||||
if !system.IsOSSupported(os) {
|
||||
return fmt.Errorf("os %q is not supported", os)
|
||||
}
|
||||
layer, err := l.lss.Get(topLayerID)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
Loading…
Reference in a new issue