From 9e0ea9709a3eaac9374b469d94b4a77a87409f9a Mon Sep 17 00:00:00 2001 From: Travis Date: Thu, 11 Mar 2021 15:49:32 -0600 Subject: [PATCH] Create the data directory during "log startup" if it doesn't already exist. Prior to using etcd for node membership, the data director was created during the cluster topology setup. Since that no longer exists, we weren't actually creating the data directory before getting to logStartup(). So this change ensure that the data directory exists. --- holder.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/holder.go b/holder.go index 375384271..8df98105d 100644 --- a/holder.go +++ b/holder.go @@ -1478,6 +1478,10 @@ func (h *Holder) logStartup() error { time := time.Now().Format(RFC3339NanoFixedWidth) logLine := fmt.Sprintf("%s\t%s\n", time, Version) + if err := os.MkdirAll(h.path, 0777); err != nil { + return errors.Wrap(err, "creating data directory") + } + f, err := os.OpenFile(h.path+"/startup.log", os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0600) if err != nil { return errors.Wrap(err, "opening startup log")