mirror of
https://github.com/drewkerrigan/nagios-http-json.git
synced 2025-05-10 09:53:44 +02:00
fix: except for pylint
This commit is contained in:
parent
1fa993ec92
commit
92592943bf
@ -363,11 +363,15 @@ class JsonRuleProcessor:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
timestamp = datetime.fromisoformat(self.helper.get(key))
|
timestamp = datetime.fromisoformat(self.helper.get(key))
|
||||||
except:
|
except ValueError as ve:
|
||||||
return " Value (%s) for key %s is not a Date in ISO format." % \
|
return " Value (%s) for key %s is not a Date in ISO format. %s" % \
|
||||||
(self.helper.get(key), alias)
|
(self.helper.get(key), alias, ve)
|
||||||
|
|
||||||
now = datetime.now(timezone.utc)
|
now = datetime.now(timezone.utc)
|
||||||
|
|
||||||
|
if timestamp.tzinfo == None:
|
||||||
|
timestamp = timestamp.replace(tzinfo=timezone.utc)
|
||||||
|
|
||||||
age = now - timestamp
|
age = now - timestamp
|
||||||
|
|
||||||
if not negative:
|
if not negative:
|
||||||
|
Loading…
Reference in New Issue
Block a user