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
+6 -3
View File
@@ -155,9 +155,12 @@ func StartGateway(ctx *cli.Context, gw Gateway) {
registerSTSRouter(router)
}
enableConfigOps := globalEtcdClient != nil && gatewayName == "nas"
enableIAMOps := globalEtcdClient != nil
// Enable IAM admin APIs if etcd is enabled, if not just enable basic
// operations such as profiling, server info etc.
registerAdminRouter(router, globalEtcdClient != nil)
registerAdminRouter(router, enableConfigOps, enableIAMOps)
// Add healthcheck router
registerHealthCheckRouter(router)
@@ -215,7 +218,7 @@ func StartGateway(ctx *cli.Context, gw Gateway) {
logger.FatalIf(err, "Unable to initialize gateway backend")
}
if globalEtcdClient != nil && gatewayName == "nas" {
if enableConfigOps {
// Create a new config system.
globalConfigSys = NewConfigSys()
@@ -242,7 +245,7 @@ func StartGateway(ctx *cli.Context, gw Gateway) {
// Create new IAM system.
globalIAMSys = NewIAMSys()
if globalEtcdClient != nil {
if enableIAMOps {
// Initialize IAM sys.
_ = globalIAMSys.Init(newObject)
}