summaryrefslogtreecommitdiff
path: root/src/op_mode/powerctrl.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-04-27 22:01:41 +0200
committerChristian Poessinger <christian@poessinger.com>2020-04-27 22:01:41 +0200
commit867a0b71acc3f1cbbcfad553952bdbc82070ae4b (patch)
treeacd9154f6ba9971f6e4178fa1b44bbff09eb8f75 /src/op_mode/powerctrl.py
parent83eea4284a61a70e62252e7ce21728ddaa4b206b (diff)
downloadvyos-1x-867a0b71acc3f1cbbcfad553952bdbc82070ae4b.tar.gz
vyos-1x-867a0b71acc3f1cbbcfad553952bdbc82070ae4b.zip
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
Diffstat (limited to 'src/op_mode/powerctrl.py')
-rwxr-xr-xsrc/op_mode/powerctrl.py2
1 files changed, 1 insertions, 1 deletions
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':