From 5fadca4939bba2583dac945153f8fe92d735523b Mon Sep 17 00:00:00 2001 From: Nemo Date: Mon, 10 Oct 2022 18:01:26 +0530 Subject: [PATCH] Add RHEL releases (#22) Co-authored-by: github-actions[bot] --- releases/redhat.json | 71 ++++++++++++++++++++++++++++++++++++++++++++ src/rhel.py | 31 +++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 releases/redhat.json create mode 100644 src/rhel.py diff --git a/releases/redhat.json b/releases/redhat.json new file mode 100644 index 00000000..6d6e871f --- /dev/null +++ b/releases/redhat.json @@ -0,0 +1,71 @@ +{ + "9.0": "2022-05-17", + "8.6": "2022-05-10", + "8.5": "2021-11-09", + "8.4": "2021-05-18", + "8.3": "2020-11-03", + "8.2": "2020-04-28", + "8.1": "2019-11-05", + "8": "2019-05-07", + "7.9": "2020-09-29", + "7.8": "2020-03-31", + "7.7": "2019-08-06", + "7.6": "2018-10-30", + "7.5": "2018-04-10", + "7.4": "2017-07-31", + "7.3": "2016-11-03", + "7.2": "2015-11-19", + "7.1": "2015-03-05", + "7.0": "2013-12-11", + "6.10": "2018-06-19", + "6.9": "2017-03-21", + "6.8": "2016-05-10", + "6.7": "2015-07-22", + "6.6": "2014-10-14", + "6.5": "2013-11-21", + "6.4": "2013-02-21", + "6.3": "2012-06-20", + "6.2": "2011-12-06", + "6.1": "2011-05-19", + "6.0": "2010-11-09", + "5.11": "2014-09-16", + "5.10": "2013-10-01", + "5.9": "2013-01-07", + "5.8": "2012-02-20", + "5.7": "2011-07-21", + "5.6": "2011-01-13", + "5.5": "2010-03-30", + "5.4": "2009-09-02", + "5.3": "2009-01-20", + "5.2": "2008-05-21", + "5.1": "2007-11-07", + "5.0": "2007-03-15", + "4.9": "2011-02-16", + "4.8": "2009-05-19", + "4.7": "2008-07-29", + "4.6": "2007-11-15", + "4.5": "2007-05-01", + "4.4": "2006-08-10", + "4.3": "2006-03-12", + "4.2": "2005-10-05", + "4.1": "2005-06-08", + "4": "2005-02-15", + "3.9": "2007-06-20", + "3.8": "2006-07-20", + "3.7": "2006-03-17", + "3.6": "2005-09-28", + "3.5": "2005-05-18", + "3.4": "2004-12-12", + "3.3": "2004-09-03", + "3.2": "2004-05-12", + "3.1": "2004-01-16", + "3": "2003-10-22", + "2.1.7": "2005-04-28", + "2.1.6": "2004-12-13", + "2.1.5": "2004-08-18", + "2.1.4": "2004-04-21", + "2.1.3": "2004-12-19", + "2.1.2": "2003-03-29", + "2.1.1": "2003-02-14", + "2.1": "2002-03-23" +} \ No newline at end of file diff --git a/src/rhel.py b/src/rhel.py new file mode 100644 index 00000000..ea3717df --- /dev/null +++ b/src/rhel.py @@ -0,0 +1,31 @@ +import json +import urllib.request +from bs4 import BeautifulSoup +import re + +URL = "https://access.redhat.com/articles/3078" +# https://regex101.com/r/877ibq/1 +regex = r"RHEL (?P\d)(\. ?(?P\d+))?(( Update (?P\d))| GA)?" + +list = {} +headers = { + 'user-agent': 'mozilla' +} +req = urllib.request.Request(URL,headers=headers) + +with urllib.request.urlopen(req, timeout=5) as response: + soup = BeautifulSoup(response, features="html5lib") + for tr in soup.findAll('tr'): + td_list = tr.findAll('td') + if len(td_list)>0: + version = td_list[0].get_text() + m = re.match(regex, version.strip()).groupdict() + version = m['major'] + if m['minor']: + version += ".%s" % m['minor'] + if m['minor2']: + version += ".%s" % m['minor2'] + list[version] = td_list[1].get_text() + +with open('releases/redhat.json', 'w') as f: + f.write(json.dumps(list, indent=2))