From 3e4efff73dfbc4f8fc5013ed0943a6e99b8aafd3 Mon Sep 17 00:00:00 2001 From: Krishnan Parthasarathi Date: Thu, 23 Sep 2021 02:34:31 -0700 Subject: [PATCH] Allow only account-key updates for azure tier (#13276) --- cmd/tier.go | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/cmd/tier.go b/cmd/tier.go index 7891e8407..3f847aeae 100644 --- a/cmd/tier.go +++ b/cmd/tier.go @@ -146,7 +146,7 @@ func (config *TierConfigMgr) Edit(ctx context.Context, tierName string, creds ma return errTierNotFound } - newCfg := config.Tiers[tierName] + cfg := config.Tiers[tierName] switch tierType { case madmin.S3: if (creds.AccessKey == "" || creds.SecretKey == "") && !creds.AWSRole { @@ -154,30 +154,29 @@ func (config *TierConfigMgr) Edit(ctx context.Context, tierName string, creds ma } switch { case creds.AWSRole: - newCfg.S3.AWSRole = true + cfg.S3.AWSRole = true default: - newCfg.S3.AccessKey = creds.AccessKey - newCfg.S3.SecretKey = creds.SecretKey + cfg.S3.AccessKey = creds.AccessKey + cfg.S3.SecretKey = creds.SecretKey } case madmin.Azure: - if creds.AccessKey == "" || creds.SecretKey == "" { + if creds.SecretKey == "" { return errTierInsufficientCreds } - newCfg.Azure.AccountName = creds.AccessKey - newCfg.Azure.AccountKey = creds.SecretKey + cfg.Azure.AccountKey = creds.SecretKey case madmin.GCS: if creds.CredsJSON == nil { return errTierInsufficientCreds } - newCfg.GCS.Creds = base64.URLEncoding.EncodeToString(creds.CredsJSON) + cfg.GCS.Creds = base64.URLEncoding.EncodeToString(creds.CredsJSON) } - d, err := newWarmBackend(ctx, newCfg) + d, err := newWarmBackend(ctx, cfg) if err != nil { return err } - config.Tiers[tierName] = newCfg + config.Tiers[tierName] = cfg config.drivercache[tierName] = d return nil }