Community discussions

 
man
newbie
Topic Author
Posts: 32
Joined: Tue Jul 25, 2017 2:58 pm

Fetch to variable in function does not work

Fri Oct 12, 2018 6:00 pm

I'm going to be mad ...

Spend hours on this function and can't make it working.
When i have added and then called it from ssh terminal works like a charm!
But when i have added it via script, i just get an on error block ("status"="failed") as a result.
:global FUNfetchToAsArr do={ 
	:do {   
	:log warning message="url=$url"; 
	:log warning message="http-data=$data";
	:local res [/tool fetch mode=$POSTMODE url=$url http-method=post http-data="$data" as-value output=user check-certificate=yes-without-crl];
	:log warning message="RESULT = $res";
		:return $res;
	} on-error={
		:return ({"status"="failed"});
	}
}
May someone help and describe why, when i have edded this function via terminal, it works well (i receive the result of port request), but when it is added from script, i get only :return ({"status"="failed"});

Futher in script this function is called like that:
:local result [$FUNfetchToAsArr url=$URL data=$postData];
 
man
newbie
Topic Author
Posts: 32
Joined: Tue Jul 25, 2017 2:58 pm

Re: Fetch to variable in function does not work

Sun Oct 14, 2018 8:08 am

Ok. Guess, it is dummy issue, when I have forgotten to declare global variable before it's usage

Who is online

Users browsing this forum: No registered users and 11 guests