Avoid code which looks at local files when etcd is configured (#7144)

This situation happens only in gateway nas which supports
etcd based `config.json` to support all FS mode features.

The issue was we would try to migrate something which doesn't
exist when etcd is configured which leads to inconsistent
server configs in memory.

This PR fixes this situation by properly loading config after
initialization, avoiding backend disk config migration to be
done only if etcd is not configured.
This commit is contained in:
Harshavardhana
2019-01-28 13:31:35 -08:00
committed by kannappanr
parent 526546d588
commit 0a28c28a8c
4 changed files with 29 additions and 33 deletions
+3 -3
View File
@@ -223,7 +223,7 @@ func StartGateway(ctx *cli.Context, gw Gateway) {
globalConfigSys = NewConfigSys()
// Load globalServerConfig from etcd
_ = globalConfigSys.Init(newObject)
logger.LogIf(context.Background(), globalConfigSys.Init(newObject))
}
// Load logger subsystem
@@ -247,7 +247,7 @@ func StartGateway(ctx *cli.Context, gw Gateway) {
globalIAMSys = NewIAMSys()
if enableIAMOps {
// Initialize IAM sys.
_ = globalIAMSys.Init(newObject)
logger.LogIf(context.Background(), globalIAMSys.Init(newObject))
}
// Create new policy system.
@@ -259,7 +259,7 @@ func StartGateway(ctx *cli.Context, gw Gateway) {
// Create new notification system.
globalNotificationSys = NewNotificationSys(globalServerConfig, globalEndpoints)
if globalEtcdClient != nil && newObject.IsNotificationSupported() {
_ = globalNotificationSys.Init(newObject)
logger.LogIf(context.Background(), globalNotificationSys.Init(newObject))
}
// Encryption support checks in gateway mode.