Skip to content

Commit

Permalink
[FSTORE-1126] python mysql client sometimes failed when user name is …
Browse files Browse the repository at this point in the history
…too long (#1441)
  • Loading branch information
bubriks authored Jan 2, 2024
1 parent 4c0ebf7 commit 02c5057
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public FeaturestoreJdbcConnectorDTO getJdbcConnectorDTO(Users user, Project proj
if(featurestoreJdbcConnectorDTO.getName()
.equals(onlineFeaturestoreController.onlineDbUsername(project, user)
+ FeaturestoreConstants.ONLINE_FEATURE_STORE_CONNECTOR_SUFFIX)) {
setPasswordPlainTextForOnlineJdbcConnector(user, featurestoreJdbcConnectorDTO, project.getName());
setPasswordPlainTextForOnlineJdbcConnector(user, featurestoreJdbcConnectorDTO, project);
}
replaceOnlineFsConnectorUrl(featurestoreJdbcConnectorDTO);
replaceOfflineFsConnectorUrl(featurestoreJdbcConnectorDTO);
Expand All @@ -147,17 +147,17 @@ public FeaturestoreJdbcConnectorDTO getJdbcConnectorDTO(Users user, Project proj
/**
* Gets the plain text password for the connector from the secret
* @param user
* @param projectName
* @param project
* @return
*/
private String getConnectorPlainPasswordFromSecret(Users user, String projectName){
String secretName = projectName.concat("_").concat(user.getUsername());
private String getConnectorPlainPasswordFromSecret(Users user, Project project){
String secretName = onlineFeaturestoreController.onlineDbUsername(project, user);
try {
SecretPlaintext plaintext = secretsController.get(user, secretName);
return plaintext.getPlaintext();
} catch (UserException e) {
LOGGER.log(Level.SEVERE, "Could not get the online jdbc connector password for project: " +
projectName + ", " + "user: " + user.getEmail());
project.getName() + ", " + "user: " + user.getEmail());
return null;
}
}
Expand All @@ -166,13 +166,13 @@ private String getConnectorPlainPasswordFromSecret(Users user, String projectNam
* Set the password in argument to plain text only if the connector is an online feature store connector
* @param user
* @param featurestoreJdbcConnectorDTO
* @param projectName
* @param project
* @returnsetPasswordInArgumentToPlainText
*/
private void setPasswordPlainTextForOnlineJdbcConnector(Users user,
FeaturestoreJdbcConnectorDTO featurestoreJdbcConnectorDTO,
String projectName) {
String connectorPassword = getConnectorPlainPasswordFromSecret(user, projectName);
Project project) {
String connectorPassword = getConnectorPlainPasswordFromSecret(user, project);
if(!Strings.isNullOrEmpty(storageConnectorUtil.fromOptions(featurestoreJdbcConnectorDTO.getArguments()))
&& !Strings.isNullOrEmpty(connectorPassword)) {
List<OptionDTO> arguments = featurestoreJdbcConnectorDTO.getArguments();
Expand Down

0 comments on commit 02c5057

Please sign in to comment.