mirror of
https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git
synced 2024-12-18 00:23:11 +00:00
Fix some pylint problems.
This commit is contained in:
parent
a6e4913a46
commit
f82958b935
@ -1,10 +1,9 @@
|
|||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import requests
|
|
||||||
import sys
|
import sys
|
||||||
from datetime import date, datetime
|
from datetime import date, datetime, timedelta
|
||||||
from dateutil.relativedelta import relativedelta
|
import requests
|
||||||
|
|
||||||
verbose = False
|
verbose = False
|
||||||
|
|
||||||
@ -40,9 +39,10 @@ def get_file_support() -> date:
|
|||||||
support_day = datetime.fromtimestamp(0)
|
support_day = datetime.fromtimestamp(0)
|
||||||
for line in lines:
|
for line in lines:
|
||||||
if "SUPPORT_END" in line:
|
if "SUPPORT_END" in line:
|
||||||
key, value = line.split('=')
|
_, value = line.split('=')
|
||||||
value = value.strip()
|
value = value.strip()
|
||||||
support_day = date.fromisoformat(value)
|
if value:
|
||||||
|
support_day = date.fromisoformat(value)
|
||||||
return support_day
|
return support_day
|
||||||
|
|
||||||
def support_date_in_future() -> bool:
|
def support_date_in_future() -> bool:
|
||||||
@ -53,18 +53,19 @@ def support_date_in_future() -> bool:
|
|||||||
# Get the necessary values from the operating system.
|
# Get the necessary values from the operating system.
|
||||||
today = datetime.today().date()
|
today = datetime.today().date()
|
||||||
log("Current date on tested system =>", today)
|
log("Current date on tested system =>", today)
|
||||||
tomorrow = today + relativedelta(years=1)
|
tomorrow = today + timedelta(days=365)
|
||||||
log(f"Minimal future EOL =>", tomorrow)
|
log("Minimal SUPPORT_END calculated from system time =>", tomorrow)
|
||||||
support = get_file_support()
|
support = get_file_support()
|
||||||
log(f"/etc/os-release SUPPORT_END =>", support)
|
log("Real /etc/os-release SUPPORT_END =>", support)
|
||||||
|
|
||||||
# Test if the support end date is in the future.
|
# Test if the support end date is in the future.
|
||||||
result = False
|
result = False
|
||||||
if support >= tomorrow:
|
if support >= tomorrow:
|
||||||
log("SUPPORT_END is in the future.")
|
log("Real SUPPORT_END is one year in the future.")
|
||||||
log("Test passed.")
|
log("Test passed.")
|
||||||
result = True
|
result = True
|
||||||
else:
|
else:
|
||||||
|
log("Real SUPPORT_END is NOT one year in the future.")
|
||||||
log("Test failed.")
|
log("Test failed.")
|
||||||
result = False
|
result = False
|
||||||
return result
|
return result
|
||||||
@ -76,4 +77,3 @@ if result:
|
|||||||
sys.exit(12)
|
sys.exit(12)
|
||||||
else:
|
else:
|
||||||
sys.exit(25)
|
sys.exit(25)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user