You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "NissimShiman (via GitHub)" <gi...@apache.org> on 2025/06/13 15:36:37 UTC

[PR] NIFI-12878 Allow flow configuration history to capture controller services enabled/disabled when done at Process Group level [nifi]

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

   
   
   <!-- 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-12878](https://issues.apache.org/jira/browse/NIFI-12878)
   
   
   # Tracking
   
   Please complete the following tracking steps prior to pull request creation.
   
   ### Issue Tracking
   
   - [ ] [Apache NiFi Jira](https://issues.apache.org/jira/browse/NIFI) issue created
   
   ### Pull Request Tracking
   
   - [ ] Pull Request title starts with Apache NiFi Jira issue number, such as `NIFI-00000`
   - [ ] Pull Request commit message starts with Apache NiFi Jira issue number, as such `NIFI-00000`
   
   ### Pull Request Formatting
   
   - [ ] Pull Request based on current revision of the `main` branch
   - [ ] 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
   
   - [ ] Build completed using `mvn clean install -P contrib-check`
     - [ ] JDK 21
   
   ### Licensing
   
   - [ ] 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)
   - [ ] New dependencies are documented in applicable `LICENSE` and `NOTICE` files
   
   ### Documentation
   
   - [ ] 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-12878 Allow flow configuration history to capture controller services enabled/disabled when done at Process Group level [nifi]

Posted by "exceptionfactory (via GitHub)" <gi...@apache.org>.
exceptionfactory merged PR #10018:
URL: https://github.com/apache/nifi/pull/10018


-- 
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-12878 Allow flow configuration history to capture controller services enabled/disabled when done at Process Group level [nifi]

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

   Thank you @exceptionfactory for looking at this.  I appreciate it.
   
   I have one question (which may need another commit).
   
   Also, there are similar issues (NIFI-14688 and NIFI-12598) which I plan to working on next but I don't know if they will be done for the 2.5 release.  (Each stands on their own, but just letting you know in case there was a desire for all commits for the same release.) 


-- 
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-12878 Allow flow configuration history to capture controller services enabled/disabled when done at Process Group level [nifi]

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


##########
nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/ProcessGroupAuditor.java:
##########
@@ -268,7 +272,35 @@ public void activateControllerServicesAdvice(ProceedingJoinPoint proceedingJoinP
             operation = Operation.Disable;
         }
 
-        saveUpdateAction(groupId, operation);
+        saveUpdateProcessGroupAction(groupId, operation);
+        for (final ControllerServiceNode csNode : controllerServiceNodes) {
+            saveUpdateControllerServiceAction(csNode, operation);
+        }
+    }
+
+    private List<ControllerServiceNode> getControllerServicesChangingState(final String groupId, final ControllerServiceState state, Collection<String> serviceIds) throws Throwable {
+        final ProcessGroupDAO processGroupDAO = getProcessGroupDAO();
+        final ProcessGroup processGroup = processGroupDAO.getProcessGroup(groupId);
+        final List<ControllerServiceNode> csNodes = new ArrayList<>();
+        for (String serviceId : serviceIds) {
+            final ControllerServiceNode csNode = processGroup.findControllerService(serviceId, true, true);
+            if (csNode != null && isControllerServiceStateChanged(csNode, state)) {

Review Comment:
   I just discovered today that this may not be a necessary check.  (i.e. it looks like all controller services at this point will have had a state change)
   
   It would be useful for future proofing, but does not currently appear to be needed.
   
   If it is determined that its only use is for future proofing, should it be kept? 
    



-- 
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-12878 Allow flow configuration history to capture controller services enabled/disabled when done at Process Group level [nifi]

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


##########
nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/ProcessGroupAuditor.java:
##########
@@ -257,6 +260,7 @@ public void enableComponentsAdvice(ProceedingJoinPoint proceedingJoinPoint, Stri
         + "execution(void activateControllerServices(String, org.apache.nifi.controller.service.ControllerServiceState, java.util.Collection<String>)) && "
         + "args(groupId, state, serviceIds)")
     public void activateControllerServicesAdvice(ProceedingJoinPoint proceedingJoinPoint, String groupId, ControllerServiceState state, Collection<String> serviceIds) throws Throwable {
+        List<ControllerServiceNode> controllerServiceNodes = getControllerServicesChangingState(groupId, state, serviceIds);

Review Comment:
   ```suggestion
           final List<ControllerServiceNode> controllerServiceNodes = getControllerServicesChangingState(groupId, state, serviceIds);
   ```



##########
nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/ProcessGroupAuditor.java:
##########
@@ -268,7 +272,33 @@ public void activateControllerServicesAdvice(ProceedingJoinPoint proceedingJoinP
             operation = Operation.Disable;
         }
 
-        saveUpdateAction(groupId, operation);
+        saveUpdateProcessGroupAction(groupId, operation);
+        for (ControllerServiceNode csNode : controllerServiceNodes) {

Review Comment:
   ```suggestion
           for (final ControllerServiceNode serviceNode : controllerServiceNodes) {
   ```



##########
nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/ProcessGroupAuditor.java:
##########
@@ -268,7 +272,33 @@ public void activateControllerServicesAdvice(ProceedingJoinPoint proceedingJoinP
             operation = Operation.Disable;
         }
 
-        saveUpdateAction(groupId, operation);
+        saveUpdateProcessGroupAction(groupId, operation);
+        for (ControllerServiceNode csNode : controllerServiceNodes) {
+            saveUpdateControllerServiceAction(csNode, operation);
+        }
+    }
+
+    private List<ControllerServiceNode> getControllerServicesChangingState(final String groupId, final ControllerServiceState state, Collection<String> serviceIds) throws Throwable {
+        ProcessGroupDAO processGroupDAO = getProcessGroupDAO();
+        ProcessGroup processGroup = processGroupDAO.getProcessGroup(groupId);
+        List<ControllerServiceNode> csNodes = new ArrayList<>();

Review Comment:
   ```suggestion
           final ProcessGroupDAO processGroupDAO = getProcessGroupDAO();
           final ProcessGroup processGroup = processGroupDAO.getProcessGroup(groupId);
           final List<ControllerServiceNode> csNodes = new ArrayList<>();
   ```



##########
nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/ProcessGroupAuditor.java:
##########
@@ -268,7 +272,33 @@ public void activateControllerServicesAdvice(ProceedingJoinPoint proceedingJoinP
             operation = Operation.Disable;
         }
 
-        saveUpdateAction(groupId, operation);
+        saveUpdateProcessGroupAction(groupId, operation);
+        for (ControllerServiceNode csNode : controllerServiceNodes) {
+            saveUpdateControllerServiceAction(csNode, operation);
+        }
+    }
+
+    private List<ControllerServiceNode> getControllerServicesChangingState(final String groupId, final ControllerServiceState state, Collection<String> serviceIds) throws Throwable {
+        ProcessGroupDAO processGroupDAO = getProcessGroupDAO();
+        ProcessGroup processGroup = processGroupDAO.getProcessGroup(groupId);
+        List<ControllerServiceNode> csNodes = new ArrayList<>();
+        for (String serviceId : serviceIds) {
+            ControllerServiceNode csNode = processGroup.findControllerService(serviceId, true, true);
+            if (csNode != null) {
+                if ((isControllerServiceDisabled(csNode) && state.equals(ControllerServiceState.ENABLED)) || isControllerServiceEnabled(csNode) && state.equals(ControllerServiceState.DISABLED)) {

Review Comment:
   It would be helpful to encapsulate this check further with a method named something along the lines of `isControllerServiceStateChanged`



##########
nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/ProcessGroupAuditor.java:
##########
@@ -268,7 +272,33 @@ public void activateControllerServicesAdvice(ProceedingJoinPoint proceedingJoinP
             operation = Operation.Disable;
         }
 
-        saveUpdateAction(groupId, operation);
+        saveUpdateProcessGroupAction(groupId, operation);
+        for (ControllerServiceNode csNode : controllerServiceNodes) {
+            saveUpdateControllerServiceAction(csNode, operation);
+        }
+    }
+
+    private List<ControllerServiceNode> getControllerServicesChangingState(final String groupId, final ControllerServiceState state, Collection<String> serviceIds) throws Throwable {
+        ProcessGroupDAO processGroupDAO = getProcessGroupDAO();
+        ProcessGroup processGroup = processGroupDAO.getProcessGroup(groupId);
+        List<ControllerServiceNode> csNodes = new ArrayList<>();
+        for (String serviceId : serviceIds) {
+            ControllerServiceNode csNode = processGroup.findControllerService(serviceId, true, true);

Review Comment:
   ```suggestion
               final ControllerServiceNode csNode = processGroup.findControllerService(serviceId, true, true);
   ```



-- 
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-12878 Allow flow configuration history to capture controller services enabled/disabled when done at Process Group level [nifi]

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

   @ChrisSamo632 Thank you for running the jobs for this.  
   Could you re-run the one that failed?


-- 
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-12878 Allow flow configuration history to capture controller services enabled/disabled when done at Process Group level [nifi]

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


##########
nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/audit/ProcessGroupAuditor.java:
##########
@@ -268,7 +272,35 @@ public void activateControllerServicesAdvice(ProceedingJoinPoint proceedingJoinP
             operation = Operation.Disable;
         }
 
-        saveUpdateAction(groupId, operation);
+        saveUpdateProcessGroupAction(groupId, operation);
+        for (final ControllerServiceNode csNode : controllerServiceNodes) {
+            saveUpdateControllerServiceAction(csNode, operation);
+        }
+    }
+
+    private List<ControllerServiceNode> getControllerServicesChangingState(final String groupId, final ControllerServiceState state, Collection<String> serviceIds) throws Throwable {
+        final ProcessGroupDAO processGroupDAO = getProcessGroupDAO();
+        final ProcessGroup processGroup = processGroupDAO.getProcessGroup(groupId);
+        final List<ControllerServiceNode> csNodes = new ArrayList<>();
+        for (String serviceId : serviceIds) {
+            final ControllerServiceNode csNode = processGroup.findControllerService(serviceId, true, true);
+            if (csNode != null && isControllerServiceStateChanged(csNode, state)) {

Review Comment:
   I just discovered today that the `isControllerServiceStateChanged()` may not be a necessary check.  (i.e. it looks like all controller services at this point will have had a state change)
   
   It would be useful for future proofing, but does not currently appear to be needed.
   
   If it is determined that its only use is for future proofing, should it be kept? 
    



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