You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by pvillard31 <gi...@git.apache.org> on 2017/07/04 08:49:20 UTC

[GitHub] nifi pull request #1974: NIFI-3281 - fix for (S)FTP processors when using EL...

GitHub user pvillard31 opened a pull request:

    https://github.com/apache/nifi/pull/1974

    NIFI-3281 - fix for (S)FTP processors when using EL against FFs

    Thank you for submitting a contribution to Apache NiFi.
    
    In order to streamline the review of the contribution we ask you
    to ensure the following steps have been taken:
    
    ### For all changes:
    - [ ] Is there a JIRA ticket associated with this PR? Is it referenced 
         in the commit message?
    
    - [ ] Does your PR title start with NIFI-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
    
    - [ ] Has your PR been rebased against the latest commit within the target branch (typically master)?
    
    - [ ] Is your initial contribution a single, squashed commit?
    
    ### For code changes:
    - [ ] Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder?
    - [ ] Have you written or updated unit tests to verify your changes?
    - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? 
    - [ ] If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly?
    - [ ] If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly?
    - [ ] If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties?
    
    ### For documentation related changes:
    - [ ] Have you ensured that format looks appropriate for the output in which it is rendered?
    
    ### Note:
    Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/pvillard31/nifi NIFI-3281

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/nifi/pull/1974.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1974
    
----
commit 573d702a1b724068fc2638a9eb6e947a93a86e3c
Author: Pierre Villard <pi...@gmail.com>
Date:   2017-07-04T08:48:41Z

    NIFI-3281 - fix for (S)FTP processors when using EL against FFs

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi issue #1974: NIFI-3281 - fix for (S)FTP processors when using EL agains...

Posted by pvillard31 <gi...@git.apache.org>.
Github user pvillard31 commented on the issue:

    https://github.com/apache/nifi/pull/1974
  
    @ijokarumawak - just pushed another commit to use flow file wherever possible and added a unit test to confirm this solves NIFI-3590 as well. It remains few ``getClient(null)`` and ``getChannel(null)`` but that's only when there is no input allowed for the processor (listing operation).


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #1974: NIFI-3281 - fix for (S)FTP processors when using EL...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/nifi/pull/1974


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #1974: NIFI-3281 - fix for (S)FTP processors when using EL...

Posted by ijokarumawak <gi...@git.apache.org>.
Github user ijokarumawak commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1974#discussion_r126053317
  
    --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/FileTransfer.java ---
    @@ -39,6 +39,8 @@
     
         void flush() throws IOException;
     
    +    boolean flush(FlowFile flowFile) throws IOException;
    --- End diff --
    
    Similar to `flush()`, other methods those use `getClient` (in FTPTransfer) or `getChannel` (in SFTPTransfer) should pass incoming FlowFile in order to evaluate EL properly. [NIFI-3590](https://issues.apache.org/jira/browse/NIFI-3590) is essentially the same to NIFI-3281 which is caused by not passing FlowFile.
    
    Do we want to address it, too? Ideally, the codes `getClient(null)` and `getChannel(null)` should be removed completely.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #1974: NIFI-3281 - fix for (S)FTP processors when using EL...

Posted by joewitt <gi...@git.apache.org>.
Github user joewitt commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1974#discussion_r125764994
  
    --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/FTPTransfer.java ---
    @@ -304,6 +304,12 @@ public void flush() throws IOException {
         }
     
         @Override
    +    public void flush(final FlowFile flowFile) throws IOException {
    +        final FTPClient client = getClient(flowFile);
    +        client.completePendingCommand();
    --- End diff --
    
    or at least in this methods case return that boolean and explain the same meaning so the caller can decide case by case how/if to handle.  Good catch


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #1974: NIFI-3281 - fix for (S)FTP processors when using EL...

Posted by ijokarumawak <gi...@git.apache.org>.
Github user ijokarumawak commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1974#discussion_r126089783
  
    --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListFileTransfer.java ---
    @@ -94,7 +94,7 @@
     
         @Override
         protected String getPath(final ProcessContext context) {
    -        return context.getProperty(REMOTE_PATH).getValue();
    +        return context.getProperty(REMOTE_PATH).evaluateAttributeExpressions().getValue();
    --- End diff --
    
    You're right, I was thinking it was FileTransfer. Thanks!


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #1974: NIFI-3281 - fix for (S)FTP processors when using EL...

Posted by ijokarumawak <gi...@git.apache.org>.
Github user ijokarumawak commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1974#discussion_r126052545
  
    --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListFileTransfer.java ---
    @@ -94,7 +94,7 @@
     
         @Override
         protected String getPath(final ProcessContext context) {
    -        return context.getProperty(REMOTE_PATH).getValue();
    +        return context.getProperty(REMOTE_PATH).evaluateAttributeExpressions().getValue();
    --- End diff --
    
    I think we should pass FlowFile to evaluate EL for REMOTE_PATH, too.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi issue #1974: NIFI-3281 - fix for (S)FTP processors when using EL agains...

Posted by pvillard31 <gi...@git.apache.org>.
Github user pvillard31 commented on the issue:

    https://github.com/apache/nifi/pull/1974
  
    Thanks @m-hogue and @joewitt for your feedback, I just pushed a commit that should address your comments: retrieve the boolean returned by ``completePendingCommand()`` and, if false, send the FF to ``REL_COMMS_FAILURE`` relationship. Also added a unit test for ``ListFTP`` to check attributes being written on flow files.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi issue #1974: NIFI-3281 - fix for (S)FTP processors when using EL agains...

Posted by ijokarumawak <gi...@git.apache.org>.
Github user ijokarumawak commented on the issue:

    https://github.com/apache/nifi/pull/1974
  
    @pvillard31 Sorry for the delay. Thanks for including the fixes for NIFI-3590. I've tested Get/Put/List/Fetch/FTP/SFTP processors with EL, especially Put and Fetch with EL using incoming FlowFile attributes. All worked well. NiFi flow template that I used for testing is available here:
    https://gist.github.com/ijokarumawak/b347520f6a7b05beca3ed8efe74d015e
    
    LGTM, +1. Merging into master. Thanks!


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #1974: NIFI-3281 - fix for (S)FTP processors when using EL...

Posted by pvillard31 <gi...@git.apache.org>.
Github user pvillard31 commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1974#discussion_r126089245
  
    --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListFileTransfer.java ---
    @@ -94,7 +94,7 @@
     
         @Override
         protected String getPath(final ProcessContext context) {
    -        return context.getProperty(REMOTE_PATH).getValue();
    +        return context.getProperty(REMOTE_PATH).evaluateAttributeExpressions().getValue();
    --- End diff --
    
    ``ListFileTransfer`` is only used for ``ListFTP`` and ``ListSFTP`` and they do not accept incoming flow files. There is no flow file to use when evaluating the property.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi issue #1974: NIFI-3281 - fix for (S)FTP processors when using EL agains...

Posted by m-hogue <gi...@git.apache.org>.
Github user m-hogue commented on the issue:

    https://github.com/apache/nifi/pull/1974
  
    LGTM. Thanks!


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #1974: NIFI-3281 - fix for (S)FTP processors when using EL...

Posted by pvillard31 <gi...@git.apache.org>.
Github user pvillard31 commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1974#discussion_r126089354
  
    --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/FileTransfer.java ---
    @@ -39,6 +39,8 @@
     
         void flush() throws IOException;
     
    +    boolean flush(FlowFile flowFile) throws IOException;
    --- End diff --
    
    Thanks @ijokarumawak, will address asap in this PR.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #1974: NIFI-3281 - fix for (S)FTP processors when using EL...

Posted by m-hogue <gi...@git.apache.org>.
Github user m-hogue commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1974#discussion_r125717086
  
    --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/FTPTransfer.java ---
    @@ -304,6 +304,12 @@ public void flush() throws IOException {
         }
     
         @Override
    +    public void flush(final FlowFile flowFile) throws IOException {
    +        final FTPClient client = getClient(flowFile);
    +        client.completePendingCommand();
    --- End diff --
    
    Should we handle the case where `client.completePendingCommand()` returns false? Per the javadocs [1], it returns false if the command couldn't be completed. 
    
    [1] https://commons.apache.org/proper/commons-net/apidocs/org/apache/commons/net/ftp/FTPClient.html#completePendingCommand()


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---