You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "mosermw (via GitHub)" <gi...@apache.org> on 2023/12/22 16:05:13 UTC

[PR] NIFI-12394 when synching to a VersionedFlow, make sure processor references to new controller services are valid [nifi]

mosermw opened a new pull request, #8184:
URL: https://github.com/apache/nifi/pull/8184

   NIFI-12394 when synching to a VersionedFlow, make sure processor references to new controller services are valid after the processor migrates the configuration of its properties.
   
   This change is to update controller service references in the CreatedExtension properties. This is important when calling migrateConfiguration on the component, because that uses the CreatedExtension properties as its "original" properties to migrate.
   
   - made sure CreatedExtension was created before the component is updated
   - made controller service reference value "final" so I can use it inside lambda function
   - fixed an unrelated but minor log INFO message problem
   - added unit test for synchronizing a new process group with an external flow definition
   
   <!-- Licensed to the Apache Software Foundation (ASF) under one or more -->
   <!-- contributor license agreements.  See the NOTICE file distributed with -->
   <!-- this work for additional information regarding copyright ownership. -->
   <!-- The ASF licenses this file to You under the Apache License, Version 2.0 -->
   <!-- (the "License"); you may not use this file except in compliance with -->
   <!-- the License.  You may obtain a copy of the License at -->
   <!--     http://www.apache.org/licenses/LICENSE-2.0 -->
   <!-- Unless required by applicable law or agreed to in writing, software -->
   <!-- distributed under the License is distributed on an "AS IS" BASIS, -->
   <!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -->
   <!-- See the License for the specific language governing permissions and -->
   <!-- limitations under the License. -->
   
   # Summary
   
   [NIFI-12394](https://issues.apache.org/jira/browse/NIFI-12394)
   
   # Tracking
   
   Please complete the following tracking steps prior to pull request creation.
   
   ### Issue Tracking
   
   - [x] [Apache NiFi Jira](https://issues.apache.org/jira/browse/NIFI) issue created
   
   ### Pull Request Tracking
   
   - [x] Pull Request title starts with Apache NiFi Jira issue number, such as `NIFI-00000`
   - [x] Pull Request commit message starts with Apache NiFi Jira issue number, as such `NIFI-00000`
   
   ### Pull Request Formatting
   
   - [x] Pull Request based on current revision of the `main` branch
   - [x] Pull Request refers to a feature branch with one commit containing changes
   
   # Verification
   
   Please indicate the verification steps performed prior to pull request creation.
   
   ### Build
   
   - [x] Build completed using `mvn clean install -P contrib-check`
     - [x] JDK 21
   
   ### Licensing
   
   - [x] New dependencies are compatible with the [Apache License 2.0](https://apache.org/licenses/LICENSE-2.0) according to the [License Policy](https://www.apache.org/legal/resolved.html)
   - [x] New dependencies are documented in applicable `LICENSE` and `NOTICE` files
   
   ### Documentation
   
   - [x] Documentation formatting appears as expected in rendered files
   


-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] NIFI-12394 when synching to a VersionedFlow, make sure processor references to new controller services are valid [nifi]

Posted by "mosermw (via GitHub)" <gi...@apache.org>.
mosermw commented on code in PR #8184:
URL: https://github.com/apache/nifi/pull/8184#discussion_r1455849633


##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/flow/synchronization/StandardVersionedComponentSynchronizer.java:
##########
@@ -1433,6 +1434,14 @@ private Map<String, String> populatePropertiesMap(final ComponentNode componentN
                         final String serviceVersionedComponentId = proposedProperties.get(propertyName);
                         String instanceId = getServiceInstanceId(serviceVersionedComponentId, group);
                         value = (instanceId == null) ? serviceVersionedComponentId : instanceId;
+
+                        // Find the same property descriptor in the component's CreatedExtension and replace it with the
+                        // instance ID of the service
+                        createdExtensions.stream().filter(ce -> ce.extension.equals(componentNode)).forEach(createdExtension -> {
+                            LOG.debug("Replacing CreatedExtension property {} old value {} with new value {}",
+                                    propertyName, createdExtension.propertyValues.get(propertyName) , value);

Review Comment:
   Good point @exceptionfactory, I have removed the debug log statement.



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] NIFI-12394 when synching to a VersionedFlow, make sure processor references to new controller services are valid [nifi]

Posted by "exceptionfactory (via GitHub)" <gi...@apache.org>.
exceptionfactory commented on code in PR #8184:
URL: https://github.com/apache/nifi/pull/8184#discussion_r1451043360


##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/flow/synchronization/StandardVersionedComponentSynchronizer.java:
##########
@@ -1433,6 +1434,14 @@ private Map<String, String> populatePropertiesMap(final ComponentNode componentN
                         final String serviceVersionedComponentId = proposedProperties.get(propertyName);
                         String instanceId = getServiceInstanceId(serviceVersionedComponentId, group);
                         value = (instanceId == null) ? serviceVersionedComponentId : instanceId;
+
+                        // Find the same property descriptor in the component's CreatedExtension and replace it with the
+                        // instance ID of the service
+                        createdExtensions.stream().filter(ce -> ce.extension.equals(componentNode)).forEach(createdExtension -> {
+                            LOG.debug("Replacing CreatedExtension property {} old value {} with new value {}",
+                                    propertyName, createdExtension.propertyValues.get(propertyName) , value);

Review Comment:
   This debug log should be removed because property values may contain sensitive information that should not be logged.
   ```suggestion
   ```



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] NIFI-12394 when synching to a VersionedFlow, make sure processor references to new controller services are valid [nifi]

Posted by "exceptionfactory (via GitHub)" <gi...@apache.org>.
exceptionfactory closed pull request #8184: NIFI-12394 when synching to a VersionedFlow, make sure processor references to new controller services are valid
URL: https://github.com/apache/nifi/pull/8184


-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] NIFI-12394 when synching to a VersionedFlow, make sure processor references to new controller services are valid [nifi]

Posted by "NissimShiman (via GitHub)" <gi...@apache.org>.
NissimShiman commented on PR #8184:
URL: https://github.com/apache/nifi/pull/8184#issuecomment-1870398821

   Reviewing...


-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org