Failure to reuse variable-defined resource in SFTP
Posted: Thu Sep 11, 2014 9:45 am
GoAnywhere Director seems to be having an issue with reusing a variable declared resourceId for an SFTP server.
I have an archiving job that reads an excel spreadsheet, where each row contains a different SFTP RESOURCE and PATH to purge files. The resource name in the spreadsheet is the string used to define/name the resource in GoAnywhere.
The main loop is:
I've tried to set the SFTP session ID and close it after the command, but the SFTP command still uses the value of resourceObj the first time it is set.
Anybody have a potential solution for this?
I have an archiving job that reads an excel spreadsheet, where each row contains a different SFTP RESOURCE and PATH to purge files. The resource name in the spreadsheet is the string used to define/name the resource in GoAnywhere.
The main loop is:
Code: Select all
I noticed that the system properly iterates through the itemsVariable for each record in my configuration spreadsheet. The first time through, it uses the server resource name "SERVER01" and uses it to purge files. When it hits the next record, it correctly reads in "SERVER02" and sets the resourceObj variable. But when the sftp statement is run the resourceId does not use the new value of the variable (resourceObj="SERVER02"), but uses "SERVER01". For each subsequent row, it updates the resourceObj variable correctly, but always uses the server that was specified the first time it was called. <forEachLoop itemsVariable="${archivalConfig}" currentItemVariable="currArchivalObject">
<setVariable name="resourceObj" value="${currArchivalObject["SRC_RESOURCE"]}" version="2.0" />
<sftp resourceId="${resourceObj}" version="1.0" onError="continue">
<delete>
<fileset dir="${currArchivalObject["SRC_LOCATION"]}">
<dateFilter>
<include to="${DateFrom}" />
</dateFilter>
</fileset>
</delete>
</sftp>
</forEachLoop>
I've tried to set the SFTP session ID and close it after the command, but the SFTP command still uses the value of resourceObj the first time it is set.
Anybody have a potential solution for this?