mirror of
https://github.com/danieldemus/openhab-core.git
synced 2026-07-29 12:34:22 +02:00
Persistence upgrader: Fix unmanaged config not respected (#5213)
* Persistence upgrader: Fix unmanaged config not respected Signed-off-by: Florian Hotze <dev@florianhotze.com>
This commit is contained in:
+9
-4
@@ -65,10 +65,11 @@ public class PersistenceUpgrader implements Upgrader {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<String> unmanagedConfigs;
|
||||||
List<String> managedConfigs;
|
List<String> managedConfigs;
|
||||||
try {
|
try {
|
||||||
managedConfigs = managedPersistenceConfigs(installedPersistenceAddons(userdataPath),
|
unmanagedConfigs = unmanagedPersistenceConfigs(confPath);
|
||||||
unmanagedPersistenceConfigs(confPath));
|
managedConfigs = managedPersistenceConfigs(installedPersistenceAddons(userdataPath), unmanagedConfigs);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.error("{} skipped: failed to read config: {}", getName(), e.getMessage());
|
logger.error("{} skipped: failed to read config: {}", getName(), e.getMessage());
|
||||||
return false;
|
return false;
|
||||||
@@ -77,6 +78,10 @@ public class PersistenceUpgrader implements Upgrader {
|
|||||||
// No managed persistence configurations, so no need to upgrade
|
// No managed persistence configurations, so no need to upgrade
|
||||||
return true;
|
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
|
Path persistenceJsonDatabasePath = userdataPath
|
||||||
.resolve(Path.of("jsondb", "org.openhab.core.persistence.PersistenceServiceConfiguration.json"));
|
.resolve(Path.of("jsondb", "org.openhab.core.persistence.PersistenceServiceConfiguration.json"));
|
||||||
@@ -165,8 +170,8 @@ public class PersistenceUpgrader implements Upgrader {
|
|||||||
private List<String> unmanagedPersistenceConfigs(Path configPath) throws IOException {
|
private List<String> unmanagedPersistenceConfigs(Path configPath) throws IOException {
|
||||||
Path persistenceConfigPath = configPath.resolve("persistence");
|
Path persistenceConfigPath = configPath.resolve("persistence");
|
||||||
try (Stream<Path> files = Files.list(persistenceConfigPath)) {
|
try (Stream<Path> files = Files.list(persistenceConfigPath)) {
|
||||||
return files.filter(configFile -> configFile.endsWith(".persist"))
|
return files.map(f -> f.getFileName().toString()).filter(f -> f.endsWith(".persist"))
|
||||||
.map(configFile -> configFile.getFileName().toString().replace(".persist", "")).toList();
|
.map(f -> f.replace(".persist", "")).toList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user