From a6dee21092fd5a08b657f3552a6b2d145d4562f3 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Wed, 6 Jan 2021 13:40:20 -0800 Subject: [PATCH] initialize IAM store before Init() to avoid any crash (#11236) --- cmd/iam.go | 3 +++ cmd/server-main.go | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/iam.go b/cmd/iam.go index abc9c49f0..164a99e20 100644 --- a/cmd/iam.go +++ b/cmd/iam.go @@ -444,6 +444,9 @@ func (sys *IAMSys) Initialized() bool { // Init - initializes config system by reading entries from config/iam func (sys *IAMSys) Init(ctx context.Context, objAPI ObjectLayer) { + // Initialize IAM store + sys.InitStore(objAPI) + retryCtx, cancel := context.WithCancel(ctx) // Indicate to our routine to exit cleanly upon return. diff --git a/cmd/server-main.go b/cmd/server-main.go index 39ddb1321..eedf18b45 100644 --- a/cmd/server-main.go +++ b/cmd/server-main.go @@ -356,9 +356,6 @@ func initAllSubsystems(ctx context.Context, newObject ObjectLayer) (err error) { logger.LogIf(ctx, fmt.Errorf("Unable to initialize config, some features may be missing %w", err)) } - // Initialize IAM store - globalIAMSys.InitStore(newObject) - // Populate existing buckets to the etcd backend if globalDNSConfig != nil { // Background this operation.