You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by jk...@apache.org on 2022/08/17 08:59:45 UTC
[unomi] branch migrationAutomation updated: UNOMI-622: keep migration history on file system after successful migration
This is an automated email from the ASF dual-hosted git repository.
jkevan pushed a commit to branch migrationAutomation
in repository https://gitbox.apache.org/repos/asf/unomi.git
The following commit(s) were added to refs/heads/migrationAutomation by this push:
new 93f62a357 UNOMI-622: keep migration history on file system after successful migration
93f62a357 is described below
commit 93f62a3575f48ac5744e3a8502d1cd17727d0318
Author: Kevan <ke...@jahia.com>
AuthorDate: Wed Aug 17 10:40:37 2022 +0200
UNOMI-622: keep migration history on file system after successful migration
---
.../org/apache/unomi/shell/migration/MigrationService.java | 4 ++--
.../unomi/shell/migration/service/MigrationContext.java | 12 ++++++++----
.../unomi/shell/migration/service/MigrationServiceImpl.java | 3 ---
.../shell/services/internal/UnomiManagementServiceImpl.java | 4 ++--
4 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/tools/shell-commands/src/main/java/org/apache/unomi/shell/migration/MigrationService.java b/tools/shell-commands/src/main/java/org/apache/unomi/shell/migration/MigrationService.java
index 7183ae325..7671771b6 100644
--- a/tools/shell-commands/src/main/java/org/apache/unomi/shell/migration/MigrationService.java
+++ b/tools/shell-commands/src/main/java/org/apache/unomi/shell/migration/MigrationService.java
@@ -24,10 +24,10 @@ import org.apache.karaf.shell.api.console.Session;
public interface MigrationService {
/**
- * This will Migrate your data in ES to be compliant with current version.
+ * This will Migrate your data in ES to be compliant with current Unomi version.
* It's possible to configure the migration using OSGI configuration file: org.apache.unomi.migration.cfg,
* if no configuration is provided then questions will be prompted during the migration process.
- * (only in case you are in karaf shell context, if not a missing configuration will fail the migration process)
+ * (only in case you are in karaf shell context, if not, a missing configuration will fail the migration process)
*
* @param originVersion Origin version without suffix/qualifier (e.g: 1.2.0)
* @param skipConfirmation Should the confirmation before starting the migration process be skipped ? (only supported in karaf shell context)
diff --git a/tools/shell-commands/src/main/java/org/apache/unomi/shell/migration/service/MigrationContext.java b/tools/shell-commands/src/main/java/org/apache/unomi/shell/migration/service/MigrationContext.java
index e86a4e18e..2f20353c2 100644
--- a/tools/shell-commands/src/main/java/org/apache/unomi/shell/migration/service/MigrationContext.java
+++ b/tools/shell-commands/src/main/java/org/apache/unomi/shell/migration/service/MigrationContext.java
@@ -253,6 +253,14 @@ public class MigrationContext {
return false;
}
+ /**
+ * This HTTP client is configured to be used for ElasticSearch requests to be able to perform migrations requests.
+ * @return the http client.
+ */
+ public CloseableHttpClient getHttpClient() {
+ return httpClient;
+ }
+
private void updateHistoryStep(String stepKey, MigrationStepState stepState) throws IOException {
printMessage("Migration step: " + stepKey + " reach: " + stepState);
@@ -260,10 +268,6 @@ public class MigrationContext {
objectMapper.writeValue(MIGRATION_FS_HISTORY_FILE.toFile(), history);
}
- public CloseableHttpClient getHttpClient() {
- return httpClient;
- }
-
protected void setHttpClient(CloseableHttpClient httpClient) {
this.httpClient = httpClient;
}
diff --git a/tools/shell-commands/src/main/java/org/apache/unomi/shell/migration/service/MigrationServiceImpl.java b/tools/shell-commands/src/main/java/org/apache/unomi/shell/migration/service/MigrationServiceImpl.java
index 232940c85..fa437cc07 100644
--- a/tools/shell-commands/src/main/java/org/apache/unomi/shell/migration/service/MigrationServiceImpl.java
+++ b/tools/shell-commands/src/main/java/org/apache/unomi/shell/migration/service/MigrationServiceImpl.java
@@ -135,9 +135,6 @@ public class MigrationServiceImpl implements MigrationService {
context.printMessage("Finish execution of: " + migrateScript);
}
-
- // We clean history, migration is successful
- context.cleanHistory();
}
}
diff --git a/tools/shell-commands/src/main/java/org/apache/unomi/shell/services/internal/UnomiManagementServiceImpl.java b/tools/shell-commands/src/main/java/org/apache/unomi/shell/services/internal/UnomiManagementServiceImpl.java
index 45c1e0279..759cd09f8 100644
--- a/tools/shell-commands/src/main/java/org/apache/unomi/shell/services/internal/UnomiManagementServiceImpl.java
+++ b/tools/shell-commands/src/main/java/org/apache/unomi/shell/services/internal/UnomiManagementServiceImpl.java
@@ -55,8 +55,8 @@ public class UnomiManagementServiceImpl implements UnomiManagementService {
migrationService.migrateUnomi(bundleContext.getProperty("unomi.autoMigrate"), true, null);
}
- if (StringUtils.isNotBlank(bundleContext.getProperty("unomi.autoStart")) && bundleContext.getProperty("unomi.autoStart")
- .equals("true")) {
+ if (StringUtils.isNotBlank(bundleContext.getProperty("unomi.autoStart")) &&
+ bundleContext.getProperty("unomi.autoStart").equals("true")) {
startUnomi();
}
}