rename OSNotSupported error

This commit is contained in:
jgsqware 2016-05-20 17:58:02 +02:00
parent 3caf788518
commit 368227e4dd
4 changed files with 5 additions and 18 deletions

View File

@ -1,13 +0,0 @@
package clair
import "errors"
const oSNotSupportedValue = "worker: OS and/or package manager are not supported"
var (
OSNotSupported = errors.New(oSNotSupportedValue)
)
type LayerError struct {
Message string
}

View File

@ -10,8 +10,8 @@ import (
"github.com/coreos/clair/api/v1"
)
//ErrOSNotSupported is returned when Clair received a layer which on os not supported
var ErrOSNotSupported = errors.New("worker: OS and/or package manager are not supported")
// ErrUnanalizedLayer is returned when the layer was not correctly analyzed
var ErrUnanalizedLayer = errors.New("layer cannot be analyzed")
//Push send a layer to Clair for analysis
func Push(layer v1.LayerEnvelope) error {
@ -35,7 +35,7 @@ func Push(layer v1.LayerEnvelope) error {
if response.StatusCode != 201 {
if response.StatusCode == 422 {
return OSNotSupported
return ErrUnanalizedLayer
}
return fmt.Errorf("receiving http error: %d", response.StatusCode)
}

View File

@ -83,7 +83,7 @@ func templatesAnalysisTemplateHtml() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "templates/analysis-template.html", size: 16409, mode: os.FileMode(420), modTime: time.Unix(1463667305, 0)}
info := bindataFileInfo{name: "templates/analysis-template.html", size: 16409, mode: os.FileMode(420), modTime: time.Unix(1463667501, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}

View File

@ -52,7 +52,7 @@ func Push(image Image) error {
payload.Layer.Path = strings.Replace(payload.Layer.Path, image.Registry, hURL, 1)
if err := clair.Push(payload); err != nil {
logrus.Infof("adding layer %d/%d [%v]: %v", index+1, layerCount, lUID, err)
if err != clair.OSNotSupported {
if err != clair.ErrUnanalizedLayer {
return err
}
parentID = ""