[REV] Copy slug file to local directory if the ftp server is not exist.

This commit is contained in:
Zhang Jiajun 2018-06-10 20:29:44 +08:00
parent f2fd4fdc7e
commit 80bb9dd115

View File

@ -373,8 +373,16 @@ func (i *ImportApp) loadApps() error {
ftpClient, err := sources.NewSFTPClient(ftpUsername, ftpPassword, ftpHost, ftpPort)
if err != nil {
logrus.Error("Failed to create ftp client: ", err)
return err
// 如果指定的ftp服务器不存在则铐到本地
os.MkdirAll(filepath.Base(shareSlugPath), 0755)
err = exec.Command("cp", fileName, shareSlugPath).Run()
if err != nil {
logrus.Error("Failed to copy slug file to local directory: ", err)
return err
}
logrus.Info("Successful copy slug file to local directory.")
continue
}
// 开始上传文件