Skip to content
This repository was archived by the owner on Feb 28, 2024. It is now read-only.

Commit 729d7a8

Browse files
lgohyipexmmontes11
authored andcommitted
Fix empty statedir check
1 parent 3196a93 commit 729d7a8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

main.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"log"
99
"os"
1010
"os/signal"
11+
"path"
1112
"syscall"
1213
"time"
1314

@@ -104,8 +105,11 @@ func main() {
104105
os.Exit(1)
105106
}
106107
if len(entries) > 0 {
107-
logger.Info("Already initialized. Init done")
108-
os.Exit(0)
108+
info, err := os.Stat(path.Join(stateDir, "grastate.dat"))
109+
if !os.IsNotExist(err) && info.Size() > 0 {
110+
logger.Info("Already initialized. Init done")
111+
os.Exit(0)
112+
}
109113
}
110114

111115
idx, err := statefulset.PodIndex(env.PodName)

0 commit comments

Comments
 (0)