Github user joewitt commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1561#discussion_r104317162
  
    --- Diff: 
nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/DeleteHDFS.java
 ---
    @@ -141,20 +141,33 @@ public void onTrigger(ProcessContext context, 
ProcessSession session) throws Pro
                 }
     
                 Map<String, String> attributes = 
Maps.newHashMapWithExpectedSize(2);
    +            boolean foundMissingFile = false;
                 for (Path path : pathList) {
                     attributes.put("filename", path.getName());
                     attributes.put("path", path.getParent().toString());
                     if (fileSystem.exists(path)) {
                         fileSystem.delete(path, 
context.getProperty(RECURSIVE).asBoolean());
    +
                         if (!context.hasIncomingConnection()) {
                             flowFile = session.create();
    +                        
session.transfer(session.putAllAttributes(flowFile, attributes), REL_SUCCESS);
                         }
    -                    session.transfer(session.putAllAttributes(flowFile, 
attributes), REL_SUCCESS);
    +
                     } else {
                         getLogger().warn("File (" + path + ") does not exist");
    +
                         if (!context.hasIncomingConnection()) {
                             flowFile = session.create();
    +                        
session.transfer(session.putAllAttributes(flowFile, attributes), REL_FAILURE);
                         }
    +
    +                }
    +            }
    +            if (context.hasIncomingConnection()) {
    +                // TODO we only put the last path deleted, change the 
semantic of the processor?
    --- End diff --
    
    We should remove this 'TODO' and instead document the behavior you're 
describing on the capability decription/and/or the WritesAttribute section.  If 
it is important for a user to see a listing of deleted items they should not 
use the wildcard here but rather use ListHDFS to create an explicit set of 
files and this processor should be honoring precisely the items specified.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to