[pan] Fix new date ingestion

This commit is contained in:
Nemo
2022-12-16 16:40:11 +05:30
parent 6d15fe62e5
commit cc624a7cd4
2 changed files with 23 additions and 7 deletions

View File

@@ -1,4 +1,14 @@
{
"3.1": "2014-09-03",
"3.2": "2015-03-31",
"3.3": "2015-11-10",
"3.4": "2016-08-21",
"4.0": "2017-04-05",
"4.1": "2017-09-15",
"4.2": "2018-06-25",
"5.0": "2018-03-19",
"6.0": "2019-02-26",
"6.1": "2019-07-02",
"7.0": "2019-12-04",
"7.1": "2020-04-22",
"7.2": "2020-09-07",

View File

@@ -1,6 +1,7 @@
import json
import urllib.request
import datetime
import re
from bs4 import BeautifulSoup
URL = "https://www.paloaltonetworks.com/services/support/end-of-life-announcements/end-of-life-summary"
@@ -28,14 +29,19 @@ def update_releases(html_identifier, file):
version = version.removesuffix("-(cortex-xdr-agent)")
version = version.removesuffix("-(vm-series-only)")
version = version.removesuffix("-(panorama-only)")
try:
month, date, year = td_list[1].get_text().split("/")
abs_date = f"{year}-{month:0>2}-{date:0>2}"
except Exception:
date = datetime.datetime.strptime(td_list[1].get_text(), "%B %d, %Y")
abs_date = date.strftime("%Y-%m-%d")
if len(td_list) > 1 and version != "":
# Date formats differ between different products
try:
month, date, year = td_list[1].get_text().split("/")
abs_date = f"{year}-{month:0>2}-{date:0>2}"
except Exception:
# A few dates have 1st, 2nd, 4th etc. Fix that:
d = td_list[1].get_text()
d = re.sub(r'(\w+) (\d{1,2})(?:\w{2}), (\d{4})', r'\1 \2, \3', d)
date = datetime.datetime.strptime(d, "%B %d, %Y")
abs_date = date.strftime("%Y-%m-%d")
versions[version] = abs_date
versions[version] = abs_date
with open("releases/%s.json" % file, "w") as f:
f.write(json.dumps(versions, indent=2))