fix bugs issue/609

This commit is contained in:
凡羊羊 2020-01-02 13:55:32 +08:00
parent ac6e5fcb8c
commit d6787d9092

View File

@ -652,6 +652,21 @@ func (g *GatewayAction) UpdCertificate(req *apimodel.UpdCertificateReq) error {
return fmt.Errorf(msg, err)
}
if cert == nil {
// cert do not exists in region db, create it
cert = &model.Certificate{
UUID: req.CertificateID,
CertificateName: req.CertificateName,
Certificate: req.Certificate,
PrivateKey: req.PrivateKey,
}
if err := db.GetManager().CertificateDao().AddModel(cert); err != nil {
msg := "update cert error :%s"
return fmt.Errorf(msg, err.Error())
}
return nil
}
cert.CertificateName = req.CertificateName
cert.Certificate = req.Certificate
cert.PrivateKey = req.PrivateKey