summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorViacheslav <v.gletenko@vyos.io>2021-10-29 16:45:58 +0000
committerViacheslav <v.gletenko@vyos.io>2021-10-29 16:45:58 +0000
commit69655d3073f462b77133033ef1130f63e562efc3 (patch)
tree3487db66225e27f275088c2521eba56aa9022685
parent4f4200f542c33e14d298cbdb2d12fe4f804188d9 (diff)
downloadvyos-1x-69655d3073f462b77133033ef1130f63e562efc3.tar.gz
vyos-1x-69655d3073f462b77133033ef1130f63e562efc3.zip
powerctl: T3862: Fix for reboot at 00:00
-rwxr-xr-xsrc/op_mode/powerctrl.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/op_mode/powerctrl.py b/src/op_mode/powerctrl.py
index a6188ec74..d4c6d47f7 100755
--- a/src/op_mode/powerctrl.py
+++ b/src/op_mode/powerctrl.py
@@ -97,7 +97,7 @@ def execute_shutdown(time, reboot = True, ask=True):
elif len(time) == 1:
# Assume the argument is just time
ts = parse_time(time[0])
- if ts:
+ if ts is not None:
cmd = check_output(["/sbin/shutdown", action, time[0]], stderr=STDOUT)
else:
sys.exit("Invalid time \"{0}\". The valid format is HH:MM".format(time[0]))
@@ -105,7 +105,7 @@ def execute_shutdown(time, reboot = True, ask=True):
# Assume it's date and time
ts = parse_time(time[0])
ds = parse_date(time[1])
- if ts and ds:
+ if ts is not None and ds:
t = datetime.combine(ds, ts)
td = t - datetime.now()
t2 = 1 + int(td.total_seconds())//60 # Get total minutes