From 867a0b71acc3f1cbbcfad553952bdbc82070ae4b Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Mon, 27 Apr 2020 22:01:41 +0200 Subject: powerctl: T2010: bugfix "TypeError: 'NoneType' object is not subscriptable" Commit d6384b2 ("powerctl: T2010: report reboot time in current timezone") added a migrator from UTC to local timezone but reading in the base value up for conversion was done outside the proper if/else clause leading to a: TypeError: 'NoneType' object is not subscriptable --- src/op_mode/powerctrl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/op_mode/powerctrl.py') diff --git a/src/op_mode/powerctrl.py b/src/op_mode/powerctrl.py index b2fb5fe5a..69af427ec 100755 --- a/src/op_mode/powerctrl.py +++ b/src/op_mode/powerctrl.py @@ -71,8 +71,8 @@ def get_shutdown_status(): def check_shutdown(): output = get_shutdown_status() - dt = datetime.strptime(output['DATETIME'], '%Y-%m-%d %H:%M:%S') if output and 'MODE' in output: + dt = datetime.strptime(output['DATETIME'], '%Y-%m-%d %H:%M:%S') if output['MODE'] == 'reboot': print("Reboot is scheduled", utc2local(dt)) elif output['MODE'] == 'poweroff': -- cgit v1.2.3