updater: move each fetcher to its own package
This commit is contained in:
parent
1b53142e38
commit
452f7018ec
@ -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"
|
||||
|
@ -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.
|
@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package fetchers
|
||||
package debian
|
||||
|
||||
import (
|
||||
"os"
|
@ -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
|
||||
}
|
@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package fetchers
|
||||
package rhel
|
||||
|
||||
import (
|
||||
"bufio"
|
@ -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())
|
||||
}
|
||||
}
|
||||
}
|
@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package fetchers
|
||||
package ubuntu
|
||||
|
||||
import (
|
||||
"bufio"
|
@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package fetchers
|
||||
package ubuntu
|
||||
|
||||
import (
|
||||
"os"
|
Loading…
Reference in New Issue
Block a user