Skip to content

Commit

Permalink
Use os-eol feature to determine end of life
Browse files Browse the repository at this point in the history
  • Loading branch information
marmarta committed May 15, 2024
1 parent 839c22d commit b20238c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
1 change: 1 addition & 0 deletions qui/eol.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"fedora-37": "2024-12-23",
"fedora-36": "2023-05-16",
"fedora-35": "2022-12-13",
"fedora-34": "2022-06-07",
Expand Down
1 change: 1 addition & 0 deletions qui/updater/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ def test_qapp():
add_feature_to_all(qapp, 'template-name', [])
add_feature_to_all(qapp, 'servicevm',
['sys-usb', 'sys-firewall', 'sys-net'])
add_feature_to_all(qapp, 'os-eol', [])

return qapp

Expand Down
22 changes: 13 additions & 9 deletions qui/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,17 @@ def run_asyncio_and_show_errors(loop, tasks, name, restart=True):
def check_support(vm):
"""Return true if the given template/standalone vm is still supported, by
default returns true"""
template_name: str = vm.features.get('template-name', '')
if not template_name:
return True
for suffix in SUFFIXES:
template_name = template_name.removesuffix(suffix)
eol = EOL_DATES.get(template_name, None)
if not eol:
return True
eol = datetime.strptime(eol, '%Y-%m-%d')
# first, check if qube itself has known eol
eol_string: str = vm.features.get('os-eol', '')

if not eol_string:
template_name: str = vm.features.get('template-name', '')
if not template_name:
return True
for suffix in SUFFIXES:
template_name = template_name.removesuffix(suffix)
eol_string = EOL_DATES.get(template_name, None)
if not eol_string:
return True
eol = datetime.strptime(eol_string, '%Y-%m-%d')
return eol > datetime.now()

0 comments on commit b20238c

Please sign in to comment.