33 lines
No EOL
1.2 KiB
Groovy
33 lines
No EOL
1.2 KiB
Groovy
ftpremote = load("${autobuilder.commonscripts()}/remoteaccess/ftp.groovy")
|
|
|
|
def getHostedFTPSiteInfo() {
|
|
echo "Using ftp site credentials: ${HOSTEDFTP_CREDENTIALS_ID}"
|
|
withCredentials([usernamePassword(credentialsId: HOSTEDFTP_CREDENTIALS_ID,
|
|
usernameVariable: 'SUDO_USERNAME',
|
|
passwordVariable: 'SUDO_PASSWORD')]) {
|
|
hostedftpsiteinfo =
|
|
ftpremote.createFTPSiteInfo("ftp.hostedftp.com",
|
|
SUDO_USERNAME,
|
|
SUDO_PASSWORD,
|
|
"/Customers/")
|
|
}
|
|
return hostedftpsiteinfo
|
|
}
|
|
|
|
def getCustomerList() {
|
|
def List<String> customerfilenames = new ArrayList<String>()
|
|
def List<String> customers = new ArrayList<String>()
|
|
|
|
def ftpsiteinfo = getHostedFTPSiteInfo()
|
|
def ftpclient = ftpremote.createFTPClient(ftpsiteinfo)
|
|
|
|
customerfilenames = ftpclient.listNames()
|
|
for(customer in customerfilenames) {
|
|
def String converted = new String(customer.getBytes("ISO-8859-1"), "UTF-8")
|
|
customers.add(converted)
|
|
}
|
|
ftpclient.disconnect()
|
|
return customers
|
|
}
|
|
|
|
return this; |