aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/presentation/input_data_files.py
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2018-04-03 09:13:23 +0200
committerTibor Frank <tifrank@cisco.com>2018-04-03 09:13:23 +0200
commit767e85ad0dcb9bcb9637188062681311fabb3307 (patch)
treec0e7032ed774e795fb901c024a98084cae63c83f /resources/tools/presentation/input_data_files.py
parent01e72f9dce0ef3eeb10ca9097836f7d34e40fa0d (diff)
PAL Trending: download input files
Change-Id: I407e3cdeb25547d46fafed702ee608f6c0e03091 Signed-off-by: Tibor Frank <tifrank@cisco.com>
Diffstat (limited to 'resources/tools/presentation/input_data_files.py')
-rw-r--r--resources/tools/presentation/input_data_files.py15
1 files changed, 11 insertions, 4 deletions
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]))