Skip to content

Commit

Permalink
Merge pull request prometheus#2283 from tcolgate/ignoredots
Browse files Browse the repository at this point in the history
ignore dotfiles in data directory
  • Loading branch information
beorn7 authored Dec 15, 2016
2 parents 4d9134e + 30be8e0 commit f3f798f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion storage/local/persistence.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,16 @@ func newPersistence(
if err != nil {
return nil, err
}
if len(fis) > 0 && !(len(fis) == 1 && fis[0].Name() == "lost+found" && fis[0].IsDir()) {
filesPresent := len(fis)
for i := range fis {
switch {
case fis[i].Name() == "lost+found" && fis[i].IsDir():
filesPresent--
case strings.HasPrefix(fis[i].Name(), "."):
filesPresent--
}
}
if filesPresent > 0 {
return nil, fmt.Errorf("found existing files in storage path that do not look like storage files compatible with this version of Prometheus; please delete the files in the storage path or choose a different storage path")
}
// Finally we can write our own version into a new version file.
Expand Down

0 comments on commit f3f798f

Please sign in to comment.