How to pass an argument into another argument in ColdFusion cfexecute function

608 Views Asked by At

I'm running ColdFusion with Splunk. Initially I pass a search to Splunk and it returns a job id. Then I must pass that job id into a cfexecute function argument. For example this is how I want the argument to look:

arguments = "-u userid:password -k https://localhost:8089/services/search/jobs/1426104412.198/results/ --get -d output_mode=csv"

The job id is "1426104412.198" and is what is returned from the first step.

This is how I have set up the cfexecute function but I don't believe the job id is being passed into it.

First I build the URL because there is a spurious space that I have to strip between "job/" and the job id.

<cfset args1="https://localhost:8089/services/search/jobs/<cfoutput>#jobid#</cfoutput>/results/">

<cfset args = reReplace(args1, "[[:space:]]", "", "ALL") />

After that I call the cfexecute function like this:

<cfexecute name = "curl.exe" 
 arguments = "-u admin:changeme -k  <cfoutput>#args#</cfoutput>  --get -d output_mode=csv" 
 outputfile="C:\common\searchresults.csv" 
 timeout = "60"> 
</cfexecute>

I have also tried this with no results and every other permutation that I can think of.

<cfexecute name = "curl.exe" 
     arguments = "-u admin:changeme -k " #args# " --get -d output_mode=csv" 
     outputfile="C:\common\searchresults.csv" 
     timeout = "60"> 
</cfexecute>

I can output the args parameter and can see that it is correct. If I hardcode the args into the arguments parameter I get results. But I get nothing when using the examples shown above.

I believe that #args# is not being passed but I do not know how to display that arguments parameter. I have been working with ColdFusion for about 8 hours and so there is much more that I do not know than I know.

So how do I pass #args# into arguments?

0

There are 0 best solutions below