Skip to content

Commit

Permalink
feat(redhat/securitydataapi): clean fetch directory before fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
MaineK00n committed Sep 3, 2024
1 parent b675f96 commit 938543a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions redhat/securitydataapi/redhat.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"log"
"os"
"path/filepath"
"time"

Expand All @@ -23,6 +24,12 @@ const (
)

func Update() error {
dirPath := filepath.Join(utils.VulnListDir(), apiDir)
log.Printf("Remove RedHat API directory %s", dirPath)
if err := os.RemoveAll(dirPath); err != nil {
return xerrors.Errorf("failed to remove RedHat API directory: %w", err)
}

now := time.Now()
for year := 1996; year <= now.Year(); year++ {
if err := update(year); err != nil {
Expand Down

0 comments on commit 938543a

Please sign in to comment.