Skip to content

Commit

Permalink
[nutanix] Convert custom script to generic script (#326)
Browse files Browse the repository at this point in the history
Convert the nutanix.py custom script to a generic script so that it retrieve only a single product data each time it is executed.
  • Loading branch information
marcwrobel authored Mar 4, 2024
1 parent 9567c36 commit 3279f06
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/nutanix.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
from common import dates, http, releasedata
import sys

from common import dates, endoflife, http, releasedata

"""Fetch Nutanix products versions from https://portal.nutanix.com/api/v1."""

PRODUCTS = {
'nutanix-aos': 'https://portal.nutanix.com/api/v1/eol/find?type=NOS',
'nutanix-files': 'https://portal.nutanix.com/api/v1/eol/find?type=FILES',
'nutanix-prism': 'https://portal.nutanix.com/api/v1/eol/find?type=PC',
}
METHOD = 'nutanix'

for product_name, url in PRODUCTS.items():
with releasedata.ProductData(product_name) as product_data:
p_filter = sys.argv[1] if len(sys.argv) > 1 else None
m_filter = sys.argv[2] if len(sys.argv) > 2 else None
for config in endoflife.list_configs(p_filter, METHOD, m_filter):
with releasedata.ProductData(config.product) as product_data:
url = f"https://portal.nutanix.com/api/v1/eol/find?type={config.url}"
data = http.fetch_url(url).json()
for version_data in data["contents"]:
release_name = '.'.join(version_data["version"].split(".")[:2])

if 'GENERAL_AVAILABILITY' in version_data:
version = version_data["version"]
date = dates.parse_datetime(version_data["GENERAL_AVAILABILITY"])
date = dates.parse_datetime(version_data["GENERAL_AVAILABILITY"]).replace(second=0)
product_data.declare_version(version, date)

0 comments on commit 3279f06

Please sign in to comment.