Log failed feature installation on error (#459)

Signed-off-by: Wouter Born <eclipse@maindrain.net>
This commit is contained in:
Wouter Born 2018-12-31 11:46:09 +01:00 committed by Kai Kreuzer
parent b4bade3e98
commit b1aeb17ee6

View File

@ -421,16 +421,32 @@ public class FeatureInstaller implements ConfigurationListener {
private synchronized void installFeatures(FeaturesService featuresService, Set<String> addons) {
try {
logger.debug("Installing '{}'", StringUtils.join(addons, ", "));
featuresService.installFeatures(addons,
EnumSet.of(FeaturesService.Option.Upgrade, FeaturesService.Option.NoFailOnFeatureNotFound));
logger.debug("Installed '{}'", StringUtils.join(addons, ", "));
try {
Feature[] features = featuresService.listInstalledFeatures();
Set<String> installed = new HashSet<>();
Set<String> failed = new HashSet<>();
for (String addon : addons) {
if (isInstalled(features, addon)) {
postInstalledEvent(addon);
installed.add(addon);
} else {
failed.add(addon);
}
}
if (installed.size() > 0) {
logger.debug("Installed '{}'", StringUtils.join(installed, ", "));
}
if (failed.size() > 0) {
logger.error("Failed installing '{}'", StringUtils.join(failed, ", "));
}
for (String addon : installed) {
postInstalledEvent(addon);
}
} catch (Exception e) {
logger.error("Failed retrieving features: {}", e.getMessage());
}