exceptionfactory commented on a change in pull request #4857:
URL: https://github.com/apache/nifi/pull/4857#discussion_r591798831
##########
File path:
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-properties-loader/src/main/java/org/apache/nifi/properties/NiFiPropertiesLoader.java
##########
@@ -241,9 +241,54 @@ public NiFiProperties load(String path) {
*/
public NiFiProperties get() {
if (instance == null) {
- instance = loadDefault();
+ instance = getDefaultProperties();
}
return instance;
}
+
+ private NiFiProperties getDefaultProperties() {
+ NiFiProperties defaultProperties = loadDefault();
+ if (isKeyGenerationRequired(defaultProperties)) {
+ final File flowConfiguration =
defaultProperties.getFlowConfigurationFile();
+ if (flowConfiguration.exists()) {
+ logger.error("Flow Configuration [{}] Found: Migration
Required for blank Sensitive Properties Key [{}]", flowConfiguration,
NiFiProperties.SENSITIVE_PROPS_KEY);
+ final String message = String.format("Sensitive Properties Key
[%s] not found: %s", NiFiProperties.SENSITIVE_PROPS_KEY,
MIGRATION_INSTRUCTIONS);
+ throw new SensitivePropertyProtectionException(message);
+ }
+ setSensitivePropertiesKey();
Review comment:
Thanks for the feedback @bbende! Calling `NiFiProperties.isClustered()`
is a simple enough check in addition to checking whether a Flow Configuration
already exists. Setting a sensitive properties key should be required for a
clustered configuration, and that could be called out separately prior to
checking for an existing Flow Configuration.
I will add the check and associated exception scenario.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]