Created this function, but it's returning an empty string.
Running through juice the file is transfered, and read, but doesn't make it into the results.
<func:function name="common:read-file-contents">
{
param $jre;
param $ftp-server;
param $file-name;
var $remote-file = "ftp://user:pw@" _ $ftp-server _ "/" _ $file-name;
var $local-file = "/var/tmp/" _ $file-name;
var $rpc-copy = <file-copy> {
<source> $remote-file;
<destination> $local-file;
}
var $rslt-copy = jcs:execute($jre, $rpc-copy);
var $rpc-show = <file-show>{
<filename>$local-file;
}
var $rslt-show = jcs:execute($jre, $rpc-show);
<func:result select="string($rslt-show//file-content)">;
}
The response is:
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/11.2R2/junos">
<file-content filename="/var/tmp/current.version" junos:seconds="1363741717" filesize="9" encoding="text">
12.1R4.7
</file-content>
<cli>
<banner></banner>
</cli>
</rpc-reply>
Any ideas?