Handle errs returned with etcd properly for config init and migration (#7134)

Returning unexpected errors can cause problems for config handling,
which is what led gateway deployments with etcd to misbehave and
had stopped working properly
This commit is contained in:
Harshavardhana
2019-01-24 00:40:59 +05:30
committed by kannappanr
parent 55ef51a99d
commit ee7dcc2903
7 changed files with 36 additions and 38 deletions

View File

@@ -31,7 +31,6 @@ import (
"time"
etcd "github.com/coreos/etcd/clientv3"
dns "github.com/minio/minio/pkg/dns"
yaml "gopkg.in/yaml.v2"
)
@@ -160,7 +159,7 @@ func loadFileConfigEtcd(filename string, clnt *etcd.Client, v interface{}) error
return fmt.Errorf("unexpected error %s returned by etcd setup, please check your endpoints %s", err, clnt.Endpoints())
}
if resp.Count == 0 {
return dns.ErrNoEntriesFound
return os.ErrNotExist
}
for _, ev := range resp.Kvs {
@@ -173,7 +172,7 @@ func loadFileConfigEtcd(filename string, clnt *etcd.Client, v interface{}) error
return toUnmarshaller(filepath.Ext(filename))(fileData, v)
}
}
return dns.ErrNoEntriesFound
return os.ErrNotExist
}
// loadFileConfig unmarshals the file's content with the right