Ask Your Question
1

Can Node Use HTTP Response at Run Time?

asked 2014-01-13 19:08:22 -0500

javatestcase gravatar image

updated 2014-01-15 13:24:03 -0500

Making an HTTP POST call at run time, and the response has the info I need to continue. I can make the call with a CURL within an exec, and I assign the XML response to status.txt.

exec { 'barracuda-check-status': command => 'curl -o status.txt -d "..." http://barracudaURL', }

So now I have a file with the info I need. But can I use the contents file at run time on the node? Or because files are all compiled on the Master, if I try to load this at run time, will I actually always be looking at the original file ... (more)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-01-15 19:11:15 -0500

ramindk gravatar image

You might want to make a custom fact to scrape the web service and then expose the data as top level variables. I'd look at the ec2 fact which does something similar.

edit flag offensive delete link more

Comments

thank you for your response. I'm going to try this out (I haven't tried Facter yet.) Do you have any opinion on using custom facts vs defined functions ...(more)

javatestcase gravatar imagejavatestcase ( 2014-01-16 11:36:41 -0500 )edit

The nice thing about a fact is that it'll run on the client machine first and then be posted to the master before catalog generation. This allows you to ...(more)

ramindk gravatar imageramindk ( 2014-02-04 11:44:52 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-01-13 19:08:22 -0500

Seen: 159 times

Last updated: Jan 15 '14