diff --git a/kura/org.eclipse.kura.core.configuration/src/main/java/org/eclipse/kura/core/configuration/ConfigurationServiceImpl.java b/kura/org.eclipse.kura.core.configuration/src/main/java/org/eclipse/kura/core/configuration/ConfigurationServiceImpl.java index f43103b5bf3..88ee61b8250 100644 --- a/kura/org.eclipse.kura.core.configuration/src/main/java/org/eclipse/kura/core/configuration/ConfigurationServiceImpl.java +++ b/kura/org.eclipse.kura.core.configuration/src/main/java/org/eclipse/kura/core/configuration/ConfigurationServiceImpl.java @@ -259,6 +259,7 @@ protected void removeConfigurableComponent(final ServiceReference configuration = Arrays.stream(configurations).filter(c -> { + final String pid = (String) c.getProperties().get(KURA_SERVICE_PID); + return pid.equals(kuraServicePid); + }).findAny(); + + if (!configuration.isPresent()) { + logger.warn("The component with kura.service.pid '{}' does not exist", kuraServicePid); + } else { + logger.info("Deleting factory configuration for component with kura.service.pid '{}'", + kuraServicePid); + configuration.get().delete(); + } + } catch (Exception e) { + logger.error("Error deleting configuration for component with kura.service.pid '{}'", kuraServicePid, e); + } + } + // returns configurations with encrypted passwords private List getComponentConfigurationsInternal() throws KuraException { List configs = new ArrayList<>();