X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Ftools%2Fpresentation%2Finput_data_files.py;h=439c0d88bd42c3d7ae9e1d4497f336c99325d9f0;hp=7e194785705225bce3d0dbf234a3e1ebdf66a846;hb=767e85ad0dcb9bcb9637188062681311fabb3307;hpb=01e72f9dce0ef3eeb10ca9097836f7d34e40fa0d diff --git a/resources/tools/presentation/input_data_files.py b/resources/tools/presentation/input_data_files.py index 7e19478570..439c0d88bd 100644 --- a/resources/tools/presentation/input_data_files.py +++ b/resources/tools/presentation/input_data_files.py @@ -37,7 +37,7 @@ CHUNK_SIZE = 512 # Separator used in file names SEPARATOR = "__" -REGEX_RELEASE = re.compile(r'(\D*)(\d{4})(\D*)') +REGEX_RELEASE = re.compile(r'(\D*)(\d{4}|master)(\D*)') def download_data_files(spec): @@ -81,6 +81,13 @@ def download_data_files(spec): try: response = get(url, stream=True) code = response.status_code + # temporary workaround, remove when output.log.xml is not needed + if code != codes["OK"] and \ + spec.input["file-name"].endswith(".gz"): + url = '.'.join(url.split('.')[:-1]) + ".log.gz" + response = get(url, stream=True) + code = response.status_code + if code != codes["OK"]: logging.warning( "Jenkins: {0}: {1}.".format(code, responses[code])) @@ -139,11 +146,11 @@ def download_data_files(spec): logging.info("{0}: {1}".format(code, responses[code])) elif spec.input["file-name"].endswith(".gz"): - rename(new_name, new_name[:-7]) - with open(new_name[:-7], 'r') as xml_file: + rename(new_name, new_name[:-3]) + with open(new_name[:-3], 'r') as xml_file: with gzip.open(new_name, 'wb') as gz_file: gz_file.write(xml_file.read()) - new_name = new_name[:-7] + new_name = new_name[:-3] status = "downloaded" logging.info("{0}: {1}".format(code, responses[code]))