You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Joseph Witt (JIRA)" <ji...@apache.org> on 2016/07/16 16:30:20 UTC

[jira] [Commented] (NIFI-2216) PutFile doesn't create missing directories specified as part of the filename attribute

    [ https://issues.apache.org/jira/browse/NIFI-2216?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15380843#comment-15380843 ] 

Joseph Witt commented on NIFI-2216:
-----------------------------------

[~randerzander] In UpdateAttribute you need to set both the 'path' attribute and the 'filename' attribute.  For your example if you want to write to the directory 'put/stuff/here' then set the path to that.  And if you want files to have the name of say the current uuid and ending in text then set 'filename' to '${uuid}.txt'.

From the output you show it is clear that the 'filename' value was set to 'service-health/${filename}' most likely.  This is seen by the '.' preceding the service-health entry which is PutFile writing to a temporary filename but this will fail because the / would be invalid.  It also looks like the 'Directory' was set to '/Users/randy/demos/consul/data/'

Creating directories does otherwise appear to work well.

So, the idea would be to use UpdateAttribute to set the 'path' as you want it and the 'filename' (which is a basename only) then in the processor configuration you can set the directory to '${path}' and be good to go.

I'll go ahead and close the ticket but if I've misunderstood please advise.

Thanks


> PutFile doesn't create missing directories specified as part of the filename attribute
> --------------------------------------------------------------------------------------
>
>                 Key: NIFI-2216
>                 URL: https://issues.apache.org/jira/browse/NIFI-2216
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Core Framework
>    Affects Versions: 0.6.0
>            Reporter: Randy Gelhausen
>
> Create the following flow:
> GenerateFlowFile->UpdateAttribute: filename:non-existant-dir/test.txt -> PutFile with "Create Missing Directories" as true and "Directory" as /Users/randy/demos/data
> Expected Behavior:
> PutFile creates "non-existant-dir" as a subdirectory in "/Users/randy/demos/data"
> Observed Behavior:
> PutFile[id=48566a2c-fae1-4797-9be2-0d46e1637980] Penalizing StandardFlowFileRecord[uuid=f078b7d3-fb16-4696-8957-75f3c7754b86,claim=StandardContentClaim [resourceClaim=StandardResourceClaim[id=1468199376676-1, container=default, section=1], offset=39462, length=1703],offset=0,name=service-health/1468199399992.json,size=1703] and transferring to failure due to org.apache.nifi.processor.exception.FlowFileAccessException: Failed to export StandardFlowFileRecord[uuid=f078b7d3-fb16-4696-8957-75f3c7754b86,claim=StandardContentClaim [resourceClaim=StandardResourceClaim[id=1468199376676-1, container=default, section=1], offset=39462, length=1703],offset=0,name=service-health/1468199399992.json,size=1703] to /Users/randy/demos/consul/data/.service-health/1468199399992.json due to java.io.FileNotFoundException: /Users/randy/demos/consul/data/.service-health/1468199399992.json (No such file or directory): org.apache.nifi.processor.exception.FlowFileAccessException: Failed to export StandardFlowFileRecord[uuid=f078b7d3-fb16-4696-8957-75f3c7754b86,claim=StandardContentClaim [resourceClaim=StandardResourceClaim[id=1468199376676-1, container=default, section=1], offset=39462, length=1703],offset=0,name=service-health/1468199399992.json,size=1703] to /Users/randy/demos/consul/data/.service-health/1468199399992.json due to java.io.FileNotFoundException: /Users/randy/demos/consul/data/.service-health/1468199399992.json (No such file or directory)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)