Skip to content

Commit

Permalink
libvuln: Make offline updater pull enrichments
Browse files Browse the repository at this point in the history
Signed-off-by: J. Victor Martins <[email protected]>
  • Loading branch information
jvdm committed Dec 2, 2023
1 parent a749ae1 commit 6f01292
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions libvuln/updates.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ package libvuln

import (
"context"
"fmt"
"io"

"github.com/google/uuid"
"github.com/jackc/pgx/v4/pgxpool"
"github.com/quay/zlog"

Expand Down Expand Up @@ -47,9 +49,16 @@ Update:
continue Update
}
}
ref, err := s.UpdateVulnerabilities(ctx, e.Updater, e.Fingerprint, e.Vuln)
if err != nil {
return err
var ref uuid.UUID
if e.Enrichment != nil {
if ref, err = s.UpdateEnrichments(ctx, e.Updater, e.Fingerprint, e.Enrichment); err != nil {
return fmt.Errorf("updating enrichements: %w", err)
}

Check warning on line 56 in libvuln/updates.go

View check run for this annotation

Codecov / codecov/patch

libvuln/updates.go#L52-L56

Added lines #L52 - L56 were not covered by tests
}
if e.Vuln != nil {
if ref, err = s.UpdateVulnerabilities(ctx, e.Updater, e.Fingerprint, e.Vuln); err != nil {
return fmt.Errorf("updating vulnerabilities: %w", err)
}

Check warning on line 61 in libvuln/updates.go

View check run for this annotation

Codecov / codecov/patch

libvuln/updates.go#L58-L61

Added lines #L58 - L61 were not covered by tests
}
zlog.Info(ctx).
Str("updater", e.Updater).
Expand Down

0 comments on commit 6f01292

Please sign in to comment.