Skip to content

Commit

Permalink
Always persist history
Browse files Browse the repository at this point in the history
Even when some exception happened during loginService
This closes #779
  • Loading branch information
kwin committed Jan 31, 2025
1 parent 7056c99 commit 9d1ab3d
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ public InstallationLog apply(String configurationRootPath, String[] restrictedTo
return applyMultipleConfigurations(restrictedToPaths, skipIfConfigUnchanged);
}
}

PersistableInstallationLogger installLog = new PersistableInstallationLogger();
Session session = null;
try {
Expand All @@ -214,13 +213,11 @@ public InstallationLog apply(String configurationRootPath, String[] restrictedTo
configFiles = configFilesRetriever.getConfigFileContentFromNode(configurationRootPath, session);
} catch (Exception e) {
installLog.addError("Could not retrieve configuration from path "+configurationRootPath+": "+e.getMessage(), e);
persistHistory(installLog);
return installLog;
}

// install config files
installConfigurationFiles(installLog, configFiles, restrictedToPaths, session, skipIfConfigUnchanged);

} catch (AuthorizableCreatorException e) {
// exception was added to history in installConfigurationFiles() before it was saved
LOG.warn("Exception during installation of authorizables (no rollback), e=" + e, e);
Expand All @@ -234,6 +231,7 @@ public InstallationLog apply(String configurationRootPath, String[] restrictedTo
LOG.error("Exception in AceServiceImpl: {}", e);
// exception was added to history in installConfigurationFiles() before it was saved
} finally {
persistHistory(installLog);
if (session != null) {
session.logout();
}
Expand Down

0 comments on commit 9d1ab3d

Please sign in to comment.