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

View File

@ -83,7 +83,7 @@ func templatesAnalysisTemplateHtml() (*asset, error) {
return nil, err 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} a := &asset{bytes: bytes, info: info}
return a, nil 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) payload.Layer.Path = strings.Replace(payload.Layer.Path, image.Registry, hURL, 1)
if err := clair.Push(payload); err != nil { if err := clair.Push(payload); err != nil {
logrus.Infof("adding layer %d/%d [%v]: %v", index+1, layerCount, lUID, err) logrus.Infof("adding layer %d/%d [%v]: %v", index+1, layerCount, lUID, err)
if err != clair.OSNotSupported { if err != clair.ErrUnanalizedLayer {
return err return err
} }
parentID = "" parentID = ""