From 30be8e0b8a7ff5f9a30c7e5818355632530a33b8 Mon Sep 17 00:00:00 2001 From: Tristan Colgate Date: Thu, 15 Dec 2016 11:48:23 +0000 Subject: [PATCH] ignore dotfiles in data directory --- storage/local/persistence.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/storage/local/persistence.go b/storage/local/persistence.go index 3eaa4d32f..0c8c83ff1 100644 --- a/storage/local/persistence.go +++ b/storage/local/persistence.go @@ -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.