From 368227e4dd1b34de2ee5268a479b377a765fc49a Mon Sep 17 00:00:00 2001 From: jgsqware Date: Fri, 20 May 2016 17:58:02 +0200 Subject: [PATCH] rename OSNotSupported error --- cmd/clairctl/clair/errors.go | 13 ------------- cmd/clairctl/clair/push.go | 6 +++--- cmd/clairctl/clair/templates.go | 2 +- cmd/clairctl/docker/push.go | 2 +- 4 files changed, 5 insertions(+), 18 deletions(-) delete mode 100644 cmd/clairctl/clair/errors.go diff --git a/cmd/clairctl/clair/errors.go b/cmd/clairctl/clair/errors.go deleted file mode 100644 index 83036a94..00000000 --- a/cmd/clairctl/clair/errors.go +++ /dev/null @@ -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 -} diff --git a/cmd/clairctl/clair/push.go b/cmd/clairctl/clair/push.go index af792fef..883a4bb2 100644 --- a/cmd/clairctl/clair/push.go +++ b/cmd/clairctl/clair/push.go @@ -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) } diff --git a/cmd/clairctl/clair/templates.go b/cmd/clairctl/clair/templates.go index 420ea7db..32812534 100644 --- a/cmd/clairctl/clair/templates.go +++ b/cmd/clairctl/clair/templates.go @@ -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 } diff --git a/cmd/clairctl/docker/push.go b/cmd/clairctl/docker/push.go index 7544cd50..185b0dd4 100644 --- a/cmd/clairctl/docker/push.go +++ b/cmd/clairctl/docker/push.go @@ -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 = ""