mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Automatic merge from release/2.4.0 -> release/2.5.0
* commit 'e862dd9118b17d8770b09672875250572118410c': 避免获取ipmi密码信息失败时,提示信息不明确
This commit is contained in:
+12
-11
@@ -2150,18 +2150,19 @@ func (self *SHost) AllowGetDetailsIpmi(ctx context.Context, userCred mcclient.To
|
||||
}
|
||||
|
||||
func (self *SHost) GetDetailsIpmi(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) (jsonutils.JSONObject, error) {
|
||||
ret := self.IpmiInfo.(*jsonutils.JSONDict)
|
||||
if ret != nil {
|
||||
password, err := ret.GetString("password")
|
||||
if err == nil {
|
||||
descryptedPassword, err := utils.DescryptAESBase64(self.Id, password)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ret.Set("password", jsonutils.NewString(descryptedPassword))
|
||||
}
|
||||
ret, ok := self.IpmiInfo.(*jsonutils.JSONDict)
|
||||
if !ok {
|
||||
return nil, httperrors.NewNotFoundError("No ipmi information was found for host %s", self.Name)
|
||||
}
|
||||
|
||||
password, err := ret.GetString("password")
|
||||
if err != nil {
|
||||
return nil, httperrors.NewNotFoundError("IPMI has no password information")
|
||||
}
|
||||
descryptedPassword, err := utils.DescryptAESBase64(self.Id, password)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ret.Set("password", jsonutils.NewString(descryptedPassword))
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user