Support Questions
Find answers, ask questions, and share your expertise

Unable to POST .rpm file using InvokeHTTP processor - NiFi

Explorer

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:

Griggsy_0-1621255023416.png

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.

Griggsy_1-1621255749430.png

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:

Griggsy_2-1621256685997.png

When I have 'Send Message Body' true - I get the following response:

Griggsy_3-1621256841121.png

When I set 'Send Message Body' false - I get:

Griggsy_4-1621257079362.png

 

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

 

 

 

 

 

4 REPLIES 4

Re: Unable to POST .rpm file using InvokeHTTP processor - NiFi

Super Guru

How are you ingesting the rpm, you need to get it in a flowfile as binary and then send it as body

Re: Unable to POST .rpm file using InvokeHTTP processor - NiFi

Community Manager

@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. 

cjervis_0-1624451801419.png

 

 

 


Cy Jervis, Manager, Community Program

Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.

Learn more about the Cloudera Community:
Community Guidelines
How to use the forum

Re: Unable to POST .rpm file using InvokeHTTP processor - NiFi

Explorer

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? 

 

Griggsy_0-1625495758732.png

 

Re: Unable to POST .rpm file using InvokeHTTP processor - NiFi

Super Guru

if you read a binary file it should be passed into NiFi with no issue.