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
|
||||
|
||||
import argparse
|
||||
import requests
|
||||
import sys
|
||||
from datetime import date, datetime
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from datetime import date, datetime, timedelta
|
||||
import requests
|
||||
|
||||
verbose = False
|
||||
|
||||
@ -40,9 +39,10 @@ def get_file_support() -> date:
|
||||
support_day = datetime.fromtimestamp(0)
|
||||
for line in lines:
|
||||
if "SUPPORT_END" in line:
|
||||
key, value = line.split('=')
|
||||
value = value.strip()
|
||||
support_day = date.fromisoformat(value)
|
||||
_, value = line.split('=')
|
||||
value = value.strip()
|
||||
if value:
|
||||
support_day = date.fromisoformat(value)
|
||||
return support_day
|
||||
|
||||
def support_date_in_future() -> bool:
|
||||
@ -53,18 +53,19 @@ def support_date_in_future() -> bool:
|
||||
# Get the necessary values from the operating system.
|
||||
today = datetime.today().date()
|
||||
log("Current date on tested system =>", today)
|
||||
tomorrow = today + relativedelta(years=1)
|
||||
log(f"Minimal future EOL =>", tomorrow)
|
||||
tomorrow = today + timedelta(days=365)
|
||||
log("Minimal SUPPORT_END calculated from system time =>", tomorrow)
|
||||
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.
|
||||
result = False
|
||||
if support >= tomorrow:
|
||||
log("SUPPORT_END is in the future.")
|
||||
log("Real SUPPORT_END is one year in the future.")
|
||||
log("Test passed.")
|
||||
result = True
|
||||
else:
|
||||
log("Real SUPPORT_END is NOT one year in the future.")
|
||||
log("Test failed.")
|
||||
result = False
|
||||
return result
|
||||
@ -76,4 +77,3 @@ if result:
|
||||
sys.exit(12)
|
||||
else:
|
||||
sys.exit(25)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user