Signed-off-by: John Howard <jhoward@microsoft.com>
| ... | ... |
@@ -57,10 +57,6 @@ func (ml *mockLayer) DiffSize() (size int64, err error) {
|
| 57 | 57 |
return 0, nil |
| 58 | 58 |
} |
| 59 | 59 |
|
| 60 |
-func (ml *mockLayer) OS() string {
|
|
| 61 |
- return ml.os |
|
| 62 |
-} |
|
| 63 |
- |
|
| 64 | 60 |
func (ml *mockLayer) Metadata() (map[string]string, error) {
|
| 65 | 61 |
return make(map[string]string), nil |
| 66 | 62 |
} |
| ... | ... |
@@ -158,10 +154,6 @@ func (ls *mockLayerStore) DriverName() string {
|
| 158 | 158 |
return "mock" |
| 159 | 159 |
} |
| 160 | 160 |
|
| 161 |
-func (ls *mockLayerStore) OS() string {
|
|
| 162 |
- return runtime.GOOS |
|
| 163 |
-} |
|
| 164 |
- |
|
| 165 | 161 |
type mockDownloadDescriptor struct {
|
| 166 | 162 |
currentDownloads *int32 |
| 167 | 163 |
id string |
| ... | ... |
@@ -224,6 +224,13 @@ func (is *store) Delete(id ID) ([]layer.Metadata, error) {
|
| 224 | 224 |
if imageMeta == nil {
|
| 225 | 225 |
return nil, fmt.Errorf("unrecognized image ID %s", id.String())
|
| 226 | 226 |
} |
| 227 |
+ img, err := is.Get(id) |
|
| 228 |
+ if err != nil {
|
|
| 229 |
+ return nil, fmt.Errorf("unrecognized image %s, %v", id.String(), err)
|
|
| 230 |
+ } |
|
| 231 |
+ if !system.IsOSSupported(img.OperatingSystem()) {
|
|
| 232 |
+ return nil, fmt.Errorf("unsupported image operating system %q", img.OperatingSystem())
|
|
| 233 |
+ } |
|
| 227 | 234 |
for id := range imageMeta.children {
|
| 228 | 235 |
is.fs.DeleteMetadata(id.Digest(), "parent") |
| 229 | 236 |
} |
| ... | ... |
@@ -238,7 +245,7 @@ func (is *store) Delete(id ID) ([]layer.Metadata, error) {
|
| 238 | 238 |
is.fs.Delete(id.Digest()) |
| 239 | 239 |
|
| 240 | 240 |
if imageMeta.layer != nil {
|
| 241 |
- return is.lss[imageMeta.layer.OS()].Release(imageMeta.layer) |
|
| 241 |
+ return is.lss[img.OperatingSystem()].Release(imageMeta.layer) |
|
| 242 | 242 |
} |
| 243 | 243 |
return nil, nil |
| 244 | 244 |
} |
| ... | ... |
@@ -100,9 +100,6 @@ type Layer interface {
|
| 100 | 100 |
// Parent returns the next layer in the layer chain. |
| 101 | 101 |
Parent() Layer |
| 102 | 102 |
|
| 103 |
- // OS returns the operating system of the layer |
|
| 104 |
- OS() string |
|
| 105 |
- |
|
| 106 | 103 |
// Size returns the size of the entire layer chain. The size |
| 107 | 104 |
// is calculated from the total size of all files in the layers. |
| 108 | 105 |
Size() (int64, error) |
| ... | ... |
@@ -148,9 +145,6 @@ type RWLayer interface {
|
| 148 | 148 |
|
| 149 | 149 |
// Metadata returns the low level metadata for the mutable layer |
| 150 | 150 |
Metadata() (map[string]string, error) |
| 151 |
- |
|
| 152 |
- // OS returns the operating system of the writable layer |
|
| 153 |
- OS() string |
|
| 154 | 151 |
} |
| 155 | 152 |
|
| 156 | 153 |
// Metadata holds information about a |
| ... | ... |
@@ -199,7 +193,6 @@ type Store interface {
|
| 199 | 199 |
Cleanup() error |
| 200 | 200 |
DriverStatus() [][2]string |
| 201 | 201 |
DriverName() string |
| 202 |
- OS() string |
|
| 203 | 202 |
} |
| 204 | 203 |
|
| 205 | 204 |
// DescribableStore represents a layer store capable of storing |
| ... | ... |
@@ -46,10 +46,6 @@ func (ml *mountedLayer) Parent() Layer {
|
| 46 | 46 |
return nil |
| 47 | 47 |
} |
| 48 | 48 |
|
| 49 |
-func (ml *mountedLayer) OS() string {
|
|
| 50 |
- return ml.layerStore.os |
|
| 51 |
-} |
|
| 52 |
- |
|
| 53 | 49 |
func (ml *mountedLayer) Size() (int64, error) {
|
| 54 | 50 |
return ml.layerStore.driver.DiffSize(ml.mountID, ml.cacheParent()) |
| 55 | 51 |
} |