Skip to content

Commit

Permalink
updater: move each fetcher to its own package
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentin-M authored and jzelinskie committed Feb 24, 2016
1 parent 1b53142 commit 452f701
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 34 deletions.
4 changes: 4 additions & 0 deletions cmd/clair/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package fetchers
package debian

import (
"os"
Expand Down
19 changes: 0 additions & 19 deletions updater/fetchers/nvd.go

This file was deleted.

2 changes: 1 addition & 1 deletion updater/fetchers/rhel.go → updater/fetchers/rhel/rhel.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package fetchers
package rhel

import (
"bufio"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package fetchers
package rhel

import (
"os"
Expand Down Expand Up @@ -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
Expand All @@ -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())
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package fetchers
package ubuntu

import (
"bufio"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package fetchers
package ubuntu

import (
"os"
Expand Down

0 comments on commit 452f701

Please sign in to comment.