more tolerance in zrokdir metadata checking (#134)

This commit is contained in:
Michael Quigley 2023-01-09 17:31:45 -05:00
parent ee7c0fcca6
commit 2ec8a07d4b
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62

View File

@ -3,6 +3,7 @@ package zrokdir
import ( import (
"encoding/json" "encoding/json"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/sirupsen/logrus"
"os" "os"
) )
@ -19,7 +20,8 @@ func checkMetadata() error {
} }
data, err := os.ReadFile(mf) data, err := os.ReadFile(mf)
if err != nil { if err != nil {
return errors.Wrapf(err, "error reading metadata file '%v'", mf) logrus.Warnf("unable to read zrokdir metadata; ignoring non-existent: %v", err)
return nil
} }
m := &Metadata{} m := &Metadata{}
if err := json.Unmarshal(data, m); err != nil { if err := json.Unmarshal(data, m); err != nil {