diff --git a/sqle/api/controller/v1/configuration.go b/sqle/api/controller/v1/configuration.go index e0ec24a73..a54e24606 100644 --- a/sqle/api/controller/v1/configuration.go +++ b/sqle/api/controller/v1/configuration.go @@ -419,7 +419,7 @@ func getGitAuthMethod(url, username, password string) (transport.AuthMethod, err if err != nil { return nil, err } - if systemVariable.Code != 0 { + if systemVariable.Data.SystemVariableSSHPrimaryKey != "" { return nil, errors.New(errors.DataNotExist, fmt.Errorf("git ssh private key not found")) } publicKeys, err := sshTransport.NewPublicKeys("git", []byte(systemVariable.Data.SystemVariableSSHPrimaryKey), "") @@ -550,7 +550,7 @@ func GetSSHPublicKey(c echo.Context) error { if err != nil { return controller.JSONBaseErrorReq(c, err) } - if systemVariable.Code != 0 { + if systemVariable.Data.SystemVariableSSHPrimaryKey == "" { return c.JSON(http.StatusOK, SSHPublicKeyInfoV1Rsp{ BaseRes: controller.NewBaseReq(nil), Data: SSHPublicKeyInfo{ diff --git a/sqle/server/clean.go b/sqle/server/clean.go index a7b3f2841..c03d406c7 100644 --- a/sqle/server/clean.go +++ b/sqle/server/clean.go @@ -157,7 +157,7 @@ func getOperationRecordExpiredHours(entry *logrus.Entry) (operationRecordExpired operationRecordExpiredHours = dms.DefaultOperationRecordExpiredHours systemVariables, err := dmsobject.GetSystemVariables(context.TODO(), dms.GetDMSServerAddress()) - if err != nil || systemVariables.Code != 0 { + if err != nil { entry.Warnf("get system variables failed, err: %s", err.Error()) return operationRecordExpiredHours }