From 70bf3cf165a66d79acc2770d9caad340477669a9 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 7 May 2019 10:08:48 -0400 Subject: [PATCH] Cleanly degrade on bad BMC time format If a BMC provided a time, but the format was not compliant, it caused an exception. Now gracefully degrade to not doing time correction if time cannot be parsed. Change-Id: I5ab45d51913232016bb55d3595ea30188bbfe2e7 --- pyghmi/redfish/command.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pyghmi/redfish/command.py b/pyghmi/redfish/command.py index 95e30fdc..da0405b8 100644 --- a/pyghmi/redfish/command.py +++ b/pyghmi/redfish/command.py @@ -1028,6 +1028,7 @@ class Command(object): correction = timedelta(0) if currtime: currtime = _parse_time(currtime) + if currtime: now = datetime.now(tz.tzoffset('', 0)) try: correction = now - currtime