mirror of
https://pagure.io/fedora-infra/ansible.git
synced 2026-02-02 20:59:02 +08:00
updates-uptimes: Change time.now() to time.time(), py not golang.
Signed-off-by: James Antill <james@and.org>
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user