Skip to content

Commit

Permalink
Remove json files
Browse files Browse the repository at this point in the history
  • Loading branch information
gen2brain committed Jan 24, 2024
1 parent c68accc commit 5e8482b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions collector/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"log"
"os"
"path/filepath"
"strconv"
"strings"
"sync"
Expand Down Expand Up @@ -349,6 +350,15 @@ func (k *KACollector) decodeJson() ([]KAStats, error) {

defer f.Close()

defer func() {
files, err := filepath.Glob("/tmp/keepalived.json*")
if err == nil {
for _, file := range files {
_ = os.Remove(file)
}
}
}()

decoder := json.NewDecoder(f)

err = decoder.Decode(&stats)
Expand Down

0 comments on commit 5e8482b

Please sign in to comment.