From a2b9a79065994b202bdf8edaebdf2e722b35306c Mon Sep 17 00:00:00 2001 From: Qu Xuan Date: Thu, 10 Sep 2020 17:22:49 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=85=BE=E8=AE=AF=E4=BA=91=E4=B8=8D?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=90=8C=E6=97=B6=E8=AE=BE=E7=BD=AE=E7=A7=98?= =?UTF-8?q?=E9=92=A5=E5=92=8C=E5=AF=86=E7=A0=81,=E8=8B=A5=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E7=A7=98=E9=92=A5=EF=BC=8C=E5=88=99=E5=B0=86=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E7=BD=AE=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/compute/models/guests.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/compute/models/guests.go b/pkg/compute/models/guests.go index c8ce37e71b..791d8195a7 100644 --- a/pkg/compute/models/guests.go +++ b/pkg/compute/models/guests.go @@ -4292,8 +4292,11 @@ func (self *SGuest) SaveDeployInfo(ctx context.Context, userCred mcclient.TokenC driver := self.GetDriver() if len(deployInfo.Account) > 0 { info["login_account"] = deployInfo.Account - if len(deployInfo.Key) > 0 && driver.IsSupportdDcryptPasswordFromSecretKey() { + if len(deployInfo.Key) > 0 { info["login_key"] = deployInfo.Key + if len(self.KeypairId) > 0 && !driver.IsSupportdDcryptPasswordFromSecretKey() { // Tencent Cloud does not support simultaneous setting of secret keys and passwords + info["login_key"], _ = seclib2.EncryptBase64(self.GetKeypairPublicKey(), "") + } info["login_key_timestamp"] = timeutils.UtcNow() } else { info["login_key"] = "none"