Skip to content

Commit

Permalink
clear old config files on run
Browse files Browse the repository at this point in the history
  • Loading branch information
natesales committed Oct 31, 2020
1 parent 836603d commit 3e48696
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"os"
"os/exec"
"path"
"path/filepath"
"strconv"
"strings"
"text/template"
Expand Down Expand Up @@ -369,6 +370,16 @@ func main() {
log.Fatalf("Execute template: %v", err)
}
log.Debug("Finished writing global config file")

files, err := filepath.Glob(path.Join(*outputDirectory, "AS*.conf"))
if err != nil {
panic(err)
}
for _, f := range files {
if err := os.Remove(f); err != nil {
log.Fatalf("Removing old config files: %v", err)
}
}
} else {
log.Info("Dry run is enabled, skipped writing global config file")
}
Expand Down

0 comments on commit 3e48696

Please sign in to comment.