From f1e68528b0c2bffecee95bd077e06b05c7f1f28d Mon Sep 17 00:00:00 2001 From: TangBin Date: Tue, 19 Nov 2019 10:17:42 +0800 Subject: [PATCH] elastic cache auth_mode status & password reset bugfix --- pkg/multicloud/aws/securitygroup.go | 4 ++++ pkg/multicloud/huawei/elasticcache_account.go | 2 +- pkg/multicloud/huawei/elasticcache_instance.go | 4 ++-- pkg/util/seclib2/seclib.go | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pkg/multicloud/aws/securitygroup.go b/pkg/multicloud/aws/securitygroup.go index 6f20ff1ab2..2efb7a7e35 100644 --- a/pkg/multicloud/aws/securitygroup.go +++ b/pkg/multicloud/aws/securitygroup.go @@ -401,6 +401,10 @@ func (self *SRegion) syncSecgroupRules(secgroupId string, rules []secrules.Secur for _, r := range DeleteRules { if err := self.delSecurityGroupRule(secgroupId, &r); err != nil { + if strings.Contains(err.Error(), "InvalidPermission.NotFound") { + continue + } + log.Errorf("delSecurityGroupRule %v error: %s", r, err.Error()) return err } diff --git a/pkg/multicloud/huawei/elasticcache_account.go b/pkg/multicloud/huawei/elasticcache_account.go index 3350294b7b..d9e59a36a6 100644 --- a/pkg/multicloud/huawei/elasticcache_account.go +++ b/pkg/multicloud/huawei/elasticcache_account.go @@ -72,7 +72,7 @@ func (self *SElasticcacheAccount) ResetPassword(input cloudprovider.SCloudElasti params := jsonutils.NewDict() params.Set("old_password", jsonutils.NewString(*input.OldPassword)) params.Set("new_password", jsonutils.NewString(input.NewPassword)) - err := DoUpdateWithSpec(self.cacheDB.region.ecsClient.Elasticcache.UpdateInContextWithSpec, self.GetId(), "password", params) + err := DoUpdateWithSpec(self.cacheDB.region.ecsClient.Elasticcache.UpdateInContextWithSpec, self.cacheDB.GetId(), "password", params) if err != nil { return errors.Wrap(err, "elasticcacheAccount.ResetPassword") } diff --git a/pkg/multicloud/huawei/elasticcache_instance.go b/pkg/multicloud/huawei/elasticcache_instance.go index 5f8dffa24c..a0b7630611 100644 --- a/pkg/multicloud/huawei/elasticcache_instance.go +++ b/pkg/multicloud/huawei/elasticcache_instance.go @@ -681,9 +681,9 @@ func (self *SElasticcache) UpdateAuthMode(noPwdAccess bool) error { func (self *SElasticcache) GetAuthMode() string { switch self.NoPasswordAccess { case "true": - return "on" - default: return "off" + default: + return "on" } } diff --git a/pkg/util/seclib2/seclib.go b/pkg/util/seclib2/seclib.go index 2ccedadfc5..baf80cc3af 100644 --- a/pkg/util/seclib2/seclib.go +++ b/pkg/util/seclib2/seclib.go @@ -25,7 +25,7 @@ const ( DIGITS = "23456789" LETTERS = "abcdefghjkmnpqrstuvwxyz" UPPERS = "ABCDEFGHJKMNPRSTUVWXYZ" - PUNC = "@%^-+=" + PUNC = "@^-+=" ALL_DIGITS = "0123456789" ALL_LETTERS = "abcdefghijklmnopqrstuvwxyz"