diff --git a/cmd/clair/main.go b/cmd/clair/main.go index e850f55652..02a299a590 100644 --- a/cmd/clair/main.go +++ b/cmd/clair/main.go @@ -26,6 +26,10 @@ import ( "github.com/coreos/pkg/capnslog" // Register components + _ "github.com/coreos/clair/notifier/notifiers" + _ "github.com/coreos/clair/updater/fetchers/debian" + _ "github.com/coreos/clair/updater/fetchers/rhel" + _ "github.com/coreos/clair/updater/fetchers/ubuntu" _ "github.com/coreos/clair/worker/detectors/feature/dpkg" _ "github.com/coreos/clair/worker/detectors/feature/rpm" _ "github.com/coreos/clair/worker/detectors/namespace/aptsources" diff --git a/updater/fetchers/debian.go b/updater/fetchers/debian/debian.go similarity index 98% rename from updater/fetchers/debian.go rename to updater/fetchers/debian/debian.go index c5a132efe3..abdf2be6fc 100644 --- a/updater/fetchers/debian.go +++ b/updater/fetchers/debian/debian.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package fetchers +package debian import ( "crypto/sha1" @@ -53,7 +53,7 @@ type jsonRel struct { type DebianFetcher struct{} func init() { - //updater.RegisterFetcher("debian", &DebianFetcher{}) + updater.RegisterFetcher("debian", &DebianFetcher{}) } // FetchUpdate fetches vulnerability updates from the Debian Security Tracker. diff --git a/updater/fetchers/debian_test.go b/updater/fetchers/debian/debian_test.go similarity index 99% rename from updater/fetchers/debian_test.go rename to updater/fetchers/debian/debian_test.go index f1243c3d67..6d0e563908 100644 --- a/updater/fetchers/debian_test.go +++ b/updater/fetchers/debian/debian_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package fetchers +package debian import ( "os" diff --git a/updater/fetchers/testdata/fetcher_debian_test.json b/updater/fetchers/debian/testdata/fetcher_debian_test.json similarity index 100% rename from updater/fetchers/testdata/fetcher_debian_test.json rename to updater/fetchers/debian/testdata/fetcher_debian_test.json diff --git a/updater/fetchers/nvd.go b/updater/fetchers/nvd.go deleted file mode 100644 index 30e16ca389..0000000000 --- a/updater/fetchers/nvd.go +++ /dev/null @@ -1,19 +0,0 @@ -package fetchers - -import "github.com/coreos/clair/updater" - -// NVDFetcher implements updater.Fetcher and gets vulnerability updates from -// the National Vulnerability Database (NVD), from the -// National Institute of Standards and Technology (NIST). -type NVDFetcher struct{} - -func init() { - //updater.RegisterFetcher("NVD", &RHELFetcher{}) -} - -// FetchUpdate gets vulnerability updates from the NVD database. -func (f *NVDFetcher) FetchUpdate() (resp updater.FetcherResponse, err error) { - log.Info("fetching NVD vulneratibilities") - - return -} diff --git a/updater/fetchers/rhel.go b/updater/fetchers/rhel/rhel.go similarity index 99% rename from updater/fetchers/rhel.go rename to updater/fetchers/rhel/rhel.go index f7780d82b2..e05955d955 100644 --- a/updater/fetchers/rhel.go +++ b/updater/fetchers/rhel/rhel.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package fetchers +package rhel import ( "bufio" diff --git a/updater/fetchers/rhel_test.go b/updater/fetchers/rhel/rhel_test.go similarity index 89% rename from updater/fetchers/rhel_test.go rename to updater/fetchers/rhel/rhel_test.go index 4db6078ff9..b4184d3a7a 100644 --- a/updater/fetchers/rhel_test.go +++ b/updater/fetchers/rhel/rhel_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package fetchers +package rhel import ( "os" @@ -56,10 +56,10 @@ func TestRHELParser(t *testing.T) { }, } - for _, expectedPackage := range expectedPackages { - assert.Contains(t, packages, expectedPackage) - assert.Contains(t, vulnerabilities[0].FixedInNodes, expectedPackage.GetNode()) - } + for _, expectedPackage := range expectedPackages { + assert.Contains(t, packages, expectedPackage) + assert.Contains(t, vulnerabilities[0].FixedInNodes, expectedPackage.GetNode()) + } } // Test parsing testdata/fetcher_rhel_test.2.xml @@ -84,9 +84,9 @@ func TestRHELParser(t *testing.T) { }, } - for _, expectedPackage := range expectedPackages { - assert.Contains(t, packages, expectedPackage) - assert.Contains(t, vulnerabilities[0].FixedInNodes, expectedPackage.GetNode()) - } + for _, expectedPackage := range expectedPackages { + assert.Contains(t, packages, expectedPackage) + assert.Contains(t, vulnerabilities[0].FixedInNodes, expectedPackage.GetNode()) + } } } diff --git a/updater/fetchers/testdata/fetcher_rhel_test.1.xml b/updater/fetchers/rhel/testdata/fetcher_rhel_test.1.xml similarity index 100% rename from updater/fetchers/testdata/fetcher_rhel_test.1.xml rename to updater/fetchers/rhel/testdata/fetcher_rhel_test.1.xml diff --git a/updater/fetchers/testdata/fetcher_rhel_test.2.xml b/updater/fetchers/rhel/testdata/fetcher_rhel_test.2.xml similarity index 100% rename from updater/fetchers/testdata/fetcher_rhel_test.2.xml rename to updater/fetchers/rhel/testdata/fetcher_rhel_test.2.xml diff --git a/updater/fetchers/testdata/fetcher_ubuntu_test.txt b/updater/fetchers/ubuntu/testdata/fetcher_ubuntu_test.txt similarity index 100% rename from updater/fetchers/testdata/fetcher_ubuntu_test.txt rename to updater/fetchers/ubuntu/testdata/fetcher_ubuntu_test.txt diff --git a/updater/fetchers/ubuntu.go b/updater/fetchers/ubuntu/ubuntu.go similarity index 99% rename from updater/fetchers/ubuntu.go rename to updater/fetchers/ubuntu/ubuntu.go index f98e76a2d8..5876bb5268 100644 --- a/updater/fetchers/ubuntu.go +++ b/updater/fetchers/ubuntu/ubuntu.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package fetchers +package ubuntu import ( "bufio" diff --git a/updater/fetchers/ubuntu_test.go b/updater/fetchers/ubuntu/ubuntu_test.go similarity index 99% rename from updater/fetchers/ubuntu_test.go rename to updater/fetchers/ubuntu/ubuntu_test.go index 1ad9e4fa79..4827ed8f2f 100644 --- a/updater/fetchers/ubuntu_test.go +++ b/updater/fetchers/ubuntu/ubuntu_test.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package fetchers +package ubuntu import ( "os"