Function to get the module from the FTP Server
(module_id, config)
| 107 | raise |
| 108 | |
| 109 | def get_build(module_id, config): |
| 110 | """ Function to get the module from the FTP Server |
| 111 | """ |
| 112 | if config.find_keep_original(module_id).lower() == "yes": |
| 113 | make_backup(module_id) |
| 114 | logger.info("["+module_id+"]FTP for this module started") |
| 115 | machine_name = config.find_ftp_info_machine_name_for_module(module_id) |
| 116 | uid = config.find_ftp_info_for_module(module_id, 'ftp_uid') |
| 117 | pwd = config.find_ftp_info_for_module(module_id, 'ftp_password') |
| 118 | ftp_loc = config.find_ftp_info_for_module(module_id, 'ftp_location') |
| 119 | local_loc = config.find_location_for_module(module_id, 'stage_location') |
| 120 | logger.debug("[" + module_id + "] Connecting to machine " + machine_name) |
| 121 | ftp_pool = FTP_pool(module_id,config) |
| 122 | local_loc = os.path.join(local_loc,os.path.basename(ftp_loc)) |
| 123 | os.makedirs(local_loc) |
| 124 | |
| 125 | try: |
| 126 | ftp = ftplib.FTP(machine_name) |
| 127 | ftp.login(uid, pwd) |
| 128 | recur_get(ftp, ftp_loc, local_loc, module_id, config, ftp_pool) |
| 129 | ftp.quit() |
| 130 | ftp_pool.close_all() |
| 131 | except: |
| 132 | ftp_pool.close_all() |
| 133 | logger.error("[" + module_id + "]Unable to access FTP location") |
| 134 | logger.error("[" + module_id + "]Error:" + str(sys.exc_info()[0]) + " " + str(sys.exc_info()[1])) |
| 135 | download_status[module_id] = "FAILED" |
| 136 | raise |
| 137 | else: |
| 138 | logger.info("[" + module_id + "] FTP for module completed") |
| 139 | download_status[module_id] = "SUCCESS" |
| 140 | |
| 141 | |
| 142 | def download_distribute(module_id, machine_list,config): |
no test coverage detected