exceptionfactory commented on code in PR #7661:
URL: https://github.com/apache/nifi/pull/7661#discussion_r1341981733
##########
nifi-toolkit/nifi-toolkit-encrypt-config/src/main/groovy/org/apache/nifi/properties/ConfigEncryptionTool.groovy:
##########
@@ -385,26 +370,26 @@ class ConfigEncryptionTool {
}
}
- if (commandLine.hasOption(FLOW_XML_ARG)) {
- if (isVerbose) {
- logger.info("Handling encryption of flow.xml.gz")
- }
- flowXmlPath = commandLine.getOptionValue(FLOW_XML_ARG)
- outputFlowXmlPath =
commandLine.getOptionValue(OUTPUT_FLOW_XML_ARG, flowXmlPath)
- handlingFlowXml = true
-
- newFlowAlgorithm =
commandLine.getOptionValue(NEW_FLOW_ALGORITHM_ARG)
- newFlowProvider =
commandLine.getOptionValue(NEW_FLOW_PROVIDER_ARG)
-
- if (flowXmlPath == outputFlowXmlPath) {
- // TODO: Add confirmation pause and provide -y flag to
offer no-interaction mode?
- logger.warn("The source flow.xml.gz and destination
flow.xml.gz are identical [${outputFlowXmlPath}] so the original will be
overwritten")
- }
-
- if (!commandLine.hasOption(NIFI_PROPERTIES_ARG)) {
- printUsageAndThrow("In order to migrate a flow.xml.gz, a
nifi.properties file must also be specified via
'-n'/'--${NIFI_PROPERTIES_ARG}'.", ExitCode.INVALID_ARGS)
- }
- }
+// if (commandLine.hasOption(FLOW_XML_ARG)) {
+// if (isVerbose) {
+// logger.info("Handling encryption of flow.xml.gz")
+// }
+// flowXmlPath = commandLine.getOptionValue(FLOW_XML_ARG)
+// outputFlowXmlPath =
commandLine.getOptionValue(OUTPUT_FLOW_XML_ARG, flowXmlPath)
+// handlingFlowXml = true
+//
+// newFlowAlgorithm =
commandLine.getOptionValue(NEW_FLOW_ALGORITHM_ARG)
+// newFlowProvider =
commandLine.getOptionValue(NEW_FLOW_PROVIDER_ARG)
+//
+// if (flowXmlPath == outputFlowXmlPath) {
+// // TODO: Add confirmation pause and provide -y flag to
offer no-interaction mode?
+// logger.warn("The source flow.xml.gz and destination
flow.xml.gz are identical [${outputFlowXmlPath}] so the original will be
overwritten")
+// }
+//
+// if (!commandLine.hasOption(NIFI_PROPERTIES_ARG)) {
+// printUsageAndThrow("In order to migrate a flow.xml.gz, a
nifi.properties file must also be specified via
'-n'/'--${NIFI_PROPERTIES_ARG}'.", ExitCode.INVALID_ARGS)
+// }
+// }
Review Comment:
This block of code needs to be uncommented and working. Although the code
says `flow.xml.gz`, it also works with `flow.json.gz`, so names should be
adjusted accordingly.
##########
nifi-toolkit/nifi-toolkit-encrypt-config/src/main/groovy/org/apache/nifi/properties/ConfigEncryptionTool.groovy:
##########
@@ -248,8 +235,6 @@ class ConfigEncryptionTool {
options.addOption(Option.builder("i").longOpt(OUTPUT_LOGIN_IDENTITY_PROVIDERS_ARG).hasArg(true).argName("file").desc("The
destination login-identity-providers.xml file containing protected config
values (will not modify input login-identity-providers.xml)").build())
options.addOption(Option.builder("a").longOpt(AUTHORIZERS_ARG).hasArg(true).argName("file").desc("The
authorizers.xml file containing unprotected config values (will be overwritten
unless -u is specified)").build())
options.addOption(Option.builder("u").longOpt(OUTPUT_AUTHORIZERS_ARG).hasArg(true).argName("file").desc("The
destination authorizers.xml file containing protected config values (will not
modify input authorizers.xml)").build())
-
options.addOption(Option.builder("f").longOpt(FLOW_XML_ARG).hasArg(true).argName("file").desc("The
flow.xml.gz file currently protected with old password (will be overwritten
unless -g is specified)").build())
-
options.addOption(Option.builder("g").longOpt(OUTPUT_FLOW_XML_ARG).hasArg(true).argName("file").desc("The
destination flow.xml.gz file containing protected config values (will not
modify input flow.xml.gz)").build())
Review Comment:
These options need to be retained and changed to indicate flow.json.gz. We
will need separate work on the toolkit in general, but at least for this PR, it
should continue to function with flow.json.gz.
##########
nifi-toolkit/nifi-toolkit-encrypt-config/src/main/groovy/org/apache/nifi/properties/ConfigEncryptionTool.groovy:
##########
@@ -722,7 +707,7 @@ class ConfigEncryptionTool {
final PropertyEncryptor inputEncryptor = new
PropertyEncryptorBuilder(existingFlowPassword).setAlgorithm(existingAlgorithm).build()
final PropertyEncryptor outputEncryptor = new
PropertyEncryptorBuilder(newFlowPassword).setAlgorithm(newAlgorithm).build()
- final FlowEncryptor flowEncryptor = new StandardFlowEncryptor()
+ final FlowEncryptor flowEncryptor = new XmlFlowEncryptor()
Review Comment:
I may not have communicated clearly in the previous comment, but
`XmlFlowEncryptor` can be removed and `StandardFlowEncryptor` should be used in
this location.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]