Skip to content

Commit

Permalink
fixing failed test
Browse files Browse the repository at this point in the history
  • Loading branch information
AssahBismarkabah committed Jan 11, 2025
1 parent fd86b07 commit 8a09d01
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,19 +165,25 @@ private void updateRealmIfNecessary(RealmImport realmImport) {
}

private void setEventsEnabledWorkaround(RealmImport realmImport) {
// https://github.com/adorsys/keycloak-config-cli/issues/338
if (realmImport.isEventsEnabled() != null) return;

Boolean existingEventsEnabled = realmRepository.get(realmImport.getRealm()).isEventsEnabled();
if (existingEventsEnabled != null) {
realmImport.setEventsEnabled(existingEventsEnabled);
RealmRepresentation existingRealm = realmRepository.get(realmImport.getRealm());
if (existingRealm != null) {
Boolean existingEventsEnabled = existingRealm.isEventsEnabled();
if (existingEventsEnabled != null) {
realmImport.setEventsEnabled(existingEventsEnabled);
} else {
realmImport.setEventsEnabled(false);
logger.warn("Events enabled status is null for realm '{}'. Setting to false by default.", realmImport.getRealm());
}
} else {
// If the realm doesn't exist yet, set a default value
realmImport.setEventsEnabled(false);
logger.warn("Events enabled status is null for realm '{}'. " + "Setting to false by default.", realmImport.getRealm());
logger.warn("Realm '{}' not found. Setting events enabled to false by default.", realmImport.getRealm());
}

}


private void createRealm(RealmImport realmImport) {
logger.debug("Creating realm '{}' ...", realmImport.getRealm());

Expand Down

0 comments on commit 8a09d01

Please sign in to comment.