mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-03-09 08:58:27 +03:00
osinfo: deal with rolling distros for EOL status
If a distribution has no EOL date set, always consider it supported if its release status is "rolling". (crobinso: reformat a bit, appease pylint) Signed-off-by: Pino Toscano <ptoscano@redhat.com>
This commit is contained in:
parent
05f4abe0d7
commit
9cd405b6ef
@ -310,6 +310,11 @@ class _OsVariant(object):
|
|||||||
eol = self._os and self._os.get_eol_date() or None
|
eol = self._os and self._os.get_eol_date() or None
|
||||||
rel = self._os and self._os.get_release_date() or None
|
rel = self._os and self._os.get_release_date() or None
|
||||||
|
|
||||||
|
# We can use os.get_release_status() & osinfo.ReleaseStatus.ROLLING
|
||||||
|
# if we require libosinfo >= 1.4.0.
|
||||||
|
release_status = self._os and self._os.get_param_value(
|
||||||
|
libosinfo.OS_PROP_RELEASE_STATUS) or None
|
||||||
|
|
||||||
def _glib_to_datetime(glibdate):
|
def _glib_to_datetime(glibdate):
|
||||||
date = "%s-%s" % (glibdate.get_year(), glibdate.get_day_of_year())
|
date = "%s-%s" % (glibdate.get_year(), glibdate.get_day_of_year())
|
||||||
return datetime.datetime.strptime(date, "%Y-%j")
|
return datetime.datetime.strptime(date, "%Y-%j")
|
||||||
@ -318,6 +323,10 @@ class _OsVariant(object):
|
|||||||
if eol is not None:
|
if eol is not None:
|
||||||
return now > _glib_to_datetime(eol)
|
return now > _glib_to_datetime(eol)
|
||||||
|
|
||||||
|
# Rolling distributions are never EOL.
|
||||||
|
if release_status == "rolling":
|
||||||
|
return False
|
||||||
|
|
||||||
# If no EOL is present, assume EOL if release was > 5 years ago
|
# If no EOL is present, assume EOL if release was > 5 years ago
|
||||||
if rel is not None:
|
if rel is not None:
|
||||||
rel5 = _glib_to_datetime(rel) + datetime.timedelta(days=365 * 5)
|
rel5 = _glib_to_datetime(rel) + datetime.timedelta(days=365 * 5)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user