nifi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joew...@apache.org
Subject [nifi] 01/02: NIFI-4573 Catch exceptions during flow content migration.
Date Tue, 01 Oct 2019 17:26:52 GMT
This is an automated email from the ASF dual-hosted git repository.

joewitt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi.git

commit c0de26b8d6ee99212659e1a58f46fb7956636a93
Author: Troy Melhase <troy@troy.io>
AuthorDate: Wed Apr 24 17:47:53 2019 -0800

    NIFI-4573 Catch exceptions during flow content migration.
---
 .../org/apache/nifi/properties/ConfigEncryptionTool.groovy       | 9 ++++++++-
 .../java/org/apache/nifi/toolkit/tls/commandLine/ExitCode.java   | 7 ++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/nifi-toolkit/nifi-toolkit-encrypt-config/src/main/groovy/org/apache/nifi/properties/ConfigEncryptionTool.groovy
b/nifi-toolkit/nifi-toolkit-encrypt-config/src/main/groovy/org/apache/nifi/properties/ConfigEncryptionTool.groovy
index 327735b..b20399d 100644
--- a/nifi-toolkit/nifi-toolkit-encrypt-config/src/main/groovy/org/apache/nifi/properties/ConfigEncryptionTool.groovy
+++ b/nifi-toolkit/nifi-toolkit-encrypt-config/src/main/groovy/org/apache/nifi/properties/ConfigEncryptionTool.groovy
@@ -1556,7 +1556,14 @@ class ConfigEncryptionTool {
                     String newAlgorithm = tool.newFlowAlgorithm ?: existingAlgorithm
                     String newProvider = tool.newFlowProvider ?: existingProvider
 
-                    tool.flowXml = tool.migrateFlowXmlContent(tool.flowXml, existingFlowPassword,
newFlowPassword, existingAlgorithm, existingProvider, newAlgorithm, newProvider)
+                    try {
+                        tool.flowXml = tool.migrateFlowXmlContent(tool.flowXml, existingFlowPassword,
newFlowPassword, existingAlgorithm, existingProvider, newAlgorithm, newProvider)
+                    } catch (Exception e) {
+                        if (tool.isVerbose) {
+                            logger.error("Encountered an error", e, "Check your password?")
+                        }
+                        tool.printUsageAndThrow("Encountered an error migrating flow content",
ExitCode.ERROR_MIGRATING_FLOW)
+                    }
 
                     // If the new key is the hard-coded internal value, don't persist it
to nifi.properties
                     if (newFlowPassword != DEFAULT_NIFI_SENSITIVE_PROPS_KEY && newFlowPassword
!= existingFlowPassword) {
diff --git a/nifi-toolkit/nifi-toolkit-tls/src/main/java/org/apache/nifi/toolkit/tls/commandLine/ExitCode.java
b/nifi-toolkit/nifi-toolkit-tls/src/main/java/org/apache/nifi/toolkit/tls/commandLine/ExitCode.java
index 234faf0..8456179 100644
--- a/nifi-toolkit/nifi-toolkit-tls/src/main/java/org/apache/nifi/toolkit/tls/commandLine/ExitCode.java
+++ b/nifi-toolkit/nifi-toolkit-tls/src/main/java/org/apache/nifi/toolkit/tls/commandLine/ExitCode.java
@@ -74,5 +74,10 @@ public enum ExitCode {
     /**
      * Unable to read existing configuration value or file
      */
-    ERROR_READING_CONFIG
+    ERROR_READING_CONFIG,
+
+    /**
+     * Unable to migrate flow content
+     */
+    ERROR_MIGRATING_FLOW
 }


Mime
View raw message