Member since
06-18-2018
39
Posts
0
Kudos Received
0
Solutions
10-20-2022
06:55 AM
Hi Team, I am creating year date time folder thru groovy ExecuteScript processor and using command execute using creating sh file and writing some content in that.. and passing that sh file to downstream ExecuteStreamCommand processor. Its failing with permission error on sh file. How to give full permission to the file which we create. def commmnd1 = "mkdir -p /shared_path/data/poc/test/1/script" def commmnd3 = "mkdir -p /shared_path/data/poc/test/1/output" def process1 = commmnd1.execute(); def process3 = commmnd3.execute(); def filePath = "${script_dir}/abcd.sh" def file2 = new File(filePath) file2.write "#!/bin/bash\n"; and one more, ExecuteStreamCommand executing sh file and it generating some files in dynamically created by previous ExecuteScript processor and these are files does not have full permission. How to give full permission which we create folder and files dynamically. Please suggest. Thanks in Advance.
... View more
Labels:
- Labels:
-
Apache NiFi
-
NiFi Registry
07-20-2022
07:48 AM
Thanks @steven-matison its is working now.. import java.nio.charset.StandardCharsets import org.apache.commons.io.IOUtils import java.nio.charset.* import groovy.io.FileType import java.io.* def flowFile = session.get() if(!flowFile) return def flowFiles = [] as List<FlowFile> def list = [] def dir = new File("/zyme_shared/nas_data/poc/zgw/output1/") dir.eachFileRecurse (FileType.FILES) { file -> list << file } list.each{ i -> def flowFile2 = session.create(flowFile) flowFile2 = session.putAttribute(flowFile2, "filename" , i.name) flowFile2 = session.write(flowFile2, { outputStream -> outputStream.write(i.getBytes()) } as OutputStreamCallback) flowFiles << flowFile2 } session.transfer(flowFiles, REL_SUCCESS) session.remove(flowFile) session.commit()
... View more
07-20-2022
06:50 AM
Hi All, Getting error in executing below script thru Execute Script processor. Requirement : upper flow will copy files to some folder.. trying to read files from folder and post them to http processor. For each file i am trying to create a new flowfile and move the same to HTTP processor. But below code failing. Can you please suggest what i am missing. -------------------------------- import java.nio.charset.StandardCharsets def flowFile = session.get() if(!flowFile) return def flowFiles = [] as List<FlowFile> def inputStream = session.read(flowFile) def list = [] def dir = new File("/root/file_data/poc/output/") dir.eachFileRecurse (FileType.FILES) { file -> list << file } list.each{ i -> def newFlowFile = session.create(flowFile) newFlowFile = session.write(newFlowFile, { outputStream -> outputStream.write( i.getBytes(StandardCharsets.UTF_8)) } as OutputStreamCallback) flowFiles << newFlowFile } session. Transfer(flowFiles, REL_SUCCESS) session.remove(flowFile) Thanks in advance!
... View more
Labels:
- Labels:
-
NiFi Registry