Simplify argument parsing (#459)
With the current state of automation scripts, this is not possible anymore to launch script with multiple auto configs.
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import logging
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
from common import dates, http, releasedata
|
||||
from common import dates, http
|
||||
from common.releasedata import ProductData, config_from_argv
|
||||
|
||||
"""Fetches EOL dates from Atlassian EOL page.
|
||||
|
||||
@@ -9,19 +10,19 @@ This script takes a selector argument which is the product title identifier on t
|
||||
`AtlassianSupportEndofLifePolicy-JiraSoftware`.
|
||||
"""
|
||||
|
||||
for config in releasedata.list_configs_from_argv():
|
||||
with releasedata.ProductData(config.product) as product_data:
|
||||
content = http.fetch_javascript_url(config.url)
|
||||
soup = BeautifulSoup(content, features="html5lib")
|
||||
config = config_from_argv()
|
||||
with ProductData(config.product) as product_data:
|
||||
content = http.fetch_javascript_url(config.url)
|
||||
soup = BeautifulSoup(content, features="html5lib")
|
||||
|
||||
# Find the section with the EOL dates
|
||||
for li in soup.select(f"#{config.data.get('selector')}+ul li"):
|
||||
match = config.first_match(li.get_text(strip=True))
|
||||
if not match:
|
||||
logging.warning(f"Skipping '{li.get_text(strip=True)}', no match found")
|
||||
continue
|
||||
# Find the section with the EOL dates
|
||||
for li in soup.select(f"#{config.data.get('selector')}+ul li"):
|
||||
match = config.first_match(li.get_text(strip=True))
|
||||
if not match:
|
||||
logging.warning(f"Skipping '{li.get_text(strip=True)}', no match found")
|
||||
continue
|
||||
|
||||
release_name = match.group("release")
|
||||
date = dates.parse_date(match.group("date"))
|
||||
release = product_data.get_release(release_name)
|
||||
release.set_eol(date)
|
||||
release_name = match.group("release")
|
||||
date = dates.parse_date(match.group("date"))
|
||||
release = product_data.get_release(release_name)
|
||||
release.set_eol(date)
|
||||
|
||||
Reference in New Issue
Block a user