updates-uptimes: Change time.now() to time.time(), py not golang.

Signed-off-by: James Antill <james@and.org>
This commit is contained in:
James Antill
2025-08-05 20:50:30 -04:00
parent 0df178ffac
commit 86a1524632
2 changed files with 10 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
---
# Note that someone probably wants to run:
# ansible -m shell -a 'dnf --refresh -y update && (rkhunter --propupd || true)' 'all:!copr*:!openqa*:!ocp*:!worker*'
# ansible -m shell -a 'dnf --refresh -y update; (rkhunter --propupd || true)' 'all:!copr*:!openqa*:!ocp*:!worker*'
# ...during an outage. Note that doing more than one vmhost at once isn't
# easily safe, because some vmhost will want another to be up while they reboot.
# Also:

View File

@@ -32,8 +32,14 @@ import fnmatch
import glob
import time
path = "/var/log/"
fname = path + "ansible-list-updates-uptime.txt"
# If we try to update this seconds since the file changed, flush the
# ansible FACT cache.
conf_dur_flush_cache = (60*60*8)
# Dir. where we put, and look for, the files...
conf_path = "/var/log/"
fname = conf_path + "ansible-list-updates-uptime.txt"
fname_today = fname + '.' + time.strftime("%Y-%m-%d")
backups = sorted(x.removeprefix(fname + '.') for x in glob.glob(fname + '.*'))
@@ -212,7 +218,7 @@ if cmd == "update":
cmd = "update-daily"
else:
mtime = os.path.getmtime(fname)
if (time.now() - mtime) <= (60*60*8): # 8 hours.
if (int(time.time()) - mtime) <= (60*60*8): # 8 hours.
cmd = "update-fast"
if cmd == "update": # Get the latest uptime.