Created on 05-17-2021 06:16 AM - last edited on 05-17-2021 09:38 AM by VidyaSargur
Hello, I have been tasked with POSTing a .rpm file (RedHat package manager) to a server location, this is to automate a manual process that we perform on a weekly basis.
I am able to download the file into NiFi using InvokeHTTP GET. At this stage the 'Content-Type' attribute shows as 'audio/x-pn-realaudio-plugin' , I have read online that this is a common mistake when dealing with .rpm files. I have then used a IdentifyMimeType processor which updates mime type to: application/x-rpm.
In the API documentation is says I require POST /rest/v1/updates as location 'file' as a parameter, see below:
I have been given the following python script that achieves what I am trying to do in Python, so far I have not been able to replicate in Nifi.
I have tried numerous different configs of the processor, manually changed attributes: file, filename, mime.extension, mime.type, Content-Type, Accept-Encoding. I have tried manually adding attributes from the Python script and referencing from the invoke. I have tried to compress to gzip as I was informed it should be in compressed format so I though NiFi had maybe changed it.
So far I have never had anything other than 'no retry' responses.
I currently have set up my invokeHTTP as below:
When I have 'Send Message Body' true - I get the following response:
When I set 'Send Message Body' false - I get:
Any assistance with this at all would be v.much appreciated. I have been trying for a number of days with every different option/config I can think of but cannot get it to POST.
In the script if mentions getting a 'csrftoken' response, am I able to do this using another invokeHTTP?
Thanks in advance
Griggsy
Created 06-16-2021 09:50 AM
How are you ingesting the rpm, you need to get it in a flowfile as binary and then send it as body
Created 06-23-2021 05:36 AM
@Griggsy have you resolved your issue? If so, please mark the appropriate reply as the solution, as it will make it easier for others to find the answer in the future.
Created 07-05-2021 07:36 AM
Thanks for the reply, I am pulling the .rpm file into NiFi using API. How do i convert it to binary?
I have not been able to get it to work using invokeHTTP so a colleague of mine has written a Python script for me to use in a excecuteScript processor. This is working in his test environment using a test .rpm file he pulled into using NiFi using GetFile as apposed to API. However in my environment using the API file the flowfile does not move through the processor? again could be as it's not binary?
Created 07-23-2021 05:42 AM
if you read a binary file it should be passed into NiFi with no issue.