mirror of https://github.com/apache/nifi.git
NIFI-4573 Catch exceptions during flow content migration.
This commit is contained in:
parent
6541eac625
commit
c0de26b8d6
|
@ -1556,7 +1556,14 @@ class ConfigEncryptionTool {
|
||||||
String newAlgorithm = tool.newFlowAlgorithm ?: existingAlgorithm
|
String newAlgorithm = tool.newFlowAlgorithm ?: existingAlgorithm
|
||||||
String newProvider = tool.newFlowProvider ?: existingProvider
|
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 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) {
|
if (newFlowPassword != DEFAULT_NIFI_SENSITIVE_PROPS_KEY && newFlowPassword != existingFlowPassword) {
|
||||||
|
|
|
@ -74,5 +74,10 @@ public enum ExitCode {
|
||||||
/**
|
/**
|
||||||
* Unable to read existing configuration value or file
|
* Unable to read existing configuration value or file
|
||||||
*/
|
*/
|
||||||
ERROR_READING_CONFIG
|
ERROR_READING_CONFIG,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unable to migrate flow content
|
||||||
|
*/
|
||||||
|
ERROR_MIGRATING_FLOW
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue