Module: check_mk
Branch: master
Commit: 93cdec9fe7e122221ed358cb51da0af549ca9315
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=93cdec9fe7e122…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Wed Apr 24 14:40:37 2019 +0200
agent_aws: Fixed comparing cache timestamps
Change-Id: I453cebbb2d6f8b2b6606f0faadab9717c654c82d
---
cmk/special_agents/agent_aws.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/cmk/special_agents/agent_aws.py b/cmk/special_agents/agent_aws.py
index cb3ed5f..1e2f411 100644
--- a/cmk/special_agents/agent_aws.py
+++ b/cmk/special_agents/agent_aws.py
@@ -645,7 +645,7 @@ class AWSSection(object):
now = time.time()
try:
- age = now - self._cache_file.stat().st_mtime
+ mtime = self._cache_file.stat().st_mtime
except OSError as e:
if e.errno == 2:
logging.info("No such file or directory %s (calculate age)",
self._cache_file)
@@ -654,11 +654,12 @@ class AWSSection(object):
logging.info("Cannot calculate cache file age: %s", e)
raise
+ age = now - mtime
if age >= self.interval:
logging.info("Cache file %s is outdated", self._cache_file)
return False
- if colleague_contents.cache_timestamp > now:
+ if colleague_contents.cache_timestamp > mtime:
logging.info("Colleague data is newer than cache file %s",
self._cache_file)
return False
return True