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.
This commit is contained in:
Travis 2021-03-11 15:49:32 -06:00
parent 9b913ce904
commit 9e0ea9709a
No known key found for this signature in database
GPG key ID: 37080CC2042BA34E

View file

@ -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")