From commits-return-41826-apmail-nifi-commits-archive=nifi.apache.org@nifi.apache.org Tue Oct 1 17:26:53 2019 Return-Path: X-Original-To: apmail-nifi-commits-archive@minotaur.apache.org Delivered-To: apmail-nifi-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by minotaur.apache.org (Postfix) with SMTP id A210E19B22 for ; Tue, 1 Oct 2019 17:26:53 +0000 (UTC) Received: (qmail 30201 invoked by uid 500); 1 Oct 2019 17:26:53 -0000 Delivered-To: apmail-nifi-commits-archive@nifi.apache.org Received: (qmail 30163 invoked by uid 500); 1 Oct 2019 17:26:53 -0000 Mailing-List: contact commits-help@nifi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@nifi.apache.org Delivered-To: mailing list commits@nifi.apache.org Received: (qmail 30064 invoked by uid 99); 1 Oct 2019 17:26:52 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Oct 2019 17:26:52 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id A3416890A3; Tue, 1 Oct 2019 17:26:52 +0000 (UTC) Date: Tue, 01 Oct 2019 17:26:52 +0000 To: "commits@nifi.apache.org" Subject: [nifi] 01/02: NIFI-4573 Catch exceptions during flow content migration. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit From: joewitt@apache.org In-Reply-To: <156995081032.1605.9636484594180806802@gitbox.apache.org> References: <156995081032.1605.9636484594180806802@gitbox.apache.org> X-Git-Host: gitbox.apache.org X-Git-Repo: nifi X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Rev: c0de26b8d6ee99212659e1a58f46fb7956636a93 X-Git-NotificationType: diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated Message-Id: <20191001172652.A3416890A3@gitbox.apache.org> 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 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 }