fix: 腾讯云不支持同时设置秘钥和密码,若设置秘钥,则将密码置空

This commit is contained in:
Qu Xuan
2020-09-10 17:22:49 +08:00
parent f4ecde37c3
commit a2b9a79065
+4 -1
View File
@@ -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"