summaryrefslogtreecommitdiff
path: root/src/helpers
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2024-10-02 12:20:15 -0500
committerJohn Estabrook <jestabro@vyos.io>2024-10-05 00:27:19 -0500
commitf9c81b121b146fbcf3c458273b2b47e6e571f2e2 (patch)
tree942f3a172f2c4d958150157d4ba08169e6c7f324 /src/helpers
parent5a59d8529c56f844c6dc62ffa6377280f01bcec1 (diff)
downloadvyos-1x-f9c81b121b146fbcf3c458273b2b47e6e571f2e2.tar.gz
vyos-1x-f9c81b121b146fbcf3c458273b2b47e6e571f2e2.zip
config-mgmt: T5976: normalize formatting
Diffstat (limited to 'src/helpers')
-rwxr-xr-xsrc/helpers/commit-confirm-notify.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/helpers/commit-confirm-notify.py b/src/helpers/commit-confirm-notify.py
index 8d7626c78..69dda5112 100755
--- a/src/helpers/commit-confirm-notify.py
+++ b/src/helpers/commit-confirm-notify.py
@@ -6,15 +6,19 @@ import time
# Minutes before reboot to trigger notification.
intervals = [1, 5, 15, 60]
+
def notify(interval):
- s = "" if interval == 1 else "s"
+ s = '' if interval == 1 else 's'
time.sleep((minutes - interval) * 60)
- message = ('"[commit-confirm] System is going to reboot in '
- f'{interval} minute{s} to rollback the last commit.\n'
- 'Confirm your changes to cancel the reboot."')
- os.system("wall -n " + message)
+ message = (
+ '"[commit-confirm] System is going to reboot in '
+ f'{interval} minute{s} to rollback the last commit.\n'
+ 'Confirm your changes to cancel the reboot."'
+ )
+ os.system('wall -n ' + message)
+
-if __name__ == "__main__":
+if __name__ == '__main__':
# Must be run as root to call wall(1) without a banner.
if len(sys.argv) != 2 or os.getuid() != 0:
print('This script requires superuser privileges.', file=sys.stderr)
@@ -27,5 +31,5 @@ if __name__ == "__main__":
for interval in sorted(intervals, reverse=True):
if minutes >= interval:
notify(interval)
- minutes -= (minutes - interval)
+ minutes -= minutes - interval
exit(0)