NIFI-4573 Catch exceptions during flow content migration.

This commit is contained in:
Troy Melhase 2019-04-24 17:47:53 -08:00 committed by Joe Witt
parent 6541eac625
commit c0de26b8d6
No known key found for this signature in database
GPG Key ID: 9093BF854F811A1A
2 changed files with 14 additions and 2 deletions

View File

@ -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) {

View File

@ -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
}