Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,11 @@ public boolean execute(@Nullable Path userdataPath, @Nullable Path confPath) {
return false;
}

List<String> unmanagedConfigs;
List<String> managedConfigs;
try {
managedConfigs = managedPersistenceConfigs(installedPersistenceAddons(userdataPath),
unmanagedPersistenceConfigs(confPath));
unmanagedConfigs = unmanagedPersistenceConfigs(confPath);
managedConfigs = managedPersistenceConfigs(installedPersistenceAddons(userdataPath), unmanagedConfigs);
} catch (IOException e) {
logger.error("{} skipped: failed to read config: {}", getName(), e.getMessage());
return false;
Expand All @@ -77,6 +78,10 @@ public boolean execute(@Nullable Path userdataPath, @Nullable Path confPath) {
// No managed persistence configurations, so no need to upgrade
return true;
}
logger.debug("found {} (missing) managed persistence configurations: {}", managedConfigs.size(),
String.join(",", managedConfigs));
logger.debug("found {} unmanaged persistence configurations: {}", unmanagedConfigs.size(),
String.join(",", unmanagedConfigs));

Path persistenceJsonDatabasePath = userdataPath
.resolve(Path.of("jsondb", "org.openhab.core.persistence.PersistenceServiceConfiguration.json"));
Expand Down Expand Up @@ -165,8 +170,8 @@ private List<String> installedPersistenceAddons(Path userdataPath) throws IOExce
private List<String> unmanagedPersistenceConfigs(Path configPath) throws IOException {
Path persistenceConfigPath = configPath.resolve("persistence");
try (Stream<Path> files = Files.list(persistenceConfigPath)) {
return files.filter(configFile -> configFile.endsWith(".persist"))
.map(configFile -> configFile.getFileName().toString().replace(".persist", "")).toList();
return files.map(f -> f.getFileName().toString()).filter(f -> f.endsWith(".persist"))
.map(f -> f.replace(".persist", "")).toList();
}
}

Expand Down