| 125 | |
| 126 | |
| 127 | def download_binary_from_ftp(host, apache_dir, release, binary): |
| 128 | successful_download = False |
| 129 | |
| 130 | try: |
| 131 | ftp = FTP(host) |
| 132 | ftp.login() |
| 133 | ftp.cwd(apache_dir + MINIFI_SUBFOLDER + release) |
| 134 | |
| 135 | print ("Downloading: ftp://" + host + "/" + MINIFI_SUBFOLDER + release + "/" + binary) |
| 136 | |
| 137 | with open(os.path.join(os.getcwd(), binary), "wb") as targetfile: |
| 138 | ftp.retrbinary("RETR " + binary, targetfile.write) |
| 139 | successful_download = True |
| 140 | except: |
| 141 | print("Failed to download binary") |
| 142 | finally: |
| 143 | ftp.quit() |
| 144 | |
| 145 | return successful_download |
| 146 | |
| 147 | |
| 148 | def main(args): |