From 28ba0ef32425ee458293a37a4a5ba664dfe577b2 Mon Sep 17 00:00:00 2001 From: Viacheslav Hletenko Date: Wed, 6 Jul 2022 15:32:42 +0000 Subject: op-mode: T4503: Prevent restart service if commit in progress Prevent op-mode scripts from restarting services if commit in progress --- src/op_mode/reset_openvpn.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/op_mode/reset_openvpn.py') diff --git a/src/op_mode/reset_openvpn.py b/src/op_mode/reset_openvpn.py index dbd3eb4d1..efbf65083 100755 --- a/src/op_mode/reset_openvpn.py +++ b/src/op_mode/reset_openvpn.py @@ -17,6 +17,7 @@ import os from sys import argv, exit from vyos.util import call +from vyos.util import commit_in_progress if __name__ == '__main__': if (len(argv) < 1): @@ -25,6 +26,9 @@ if __name__ == '__main__': interface = argv[1] if os.path.isfile(f'/run/openvpn/{interface}.conf'): + if commit_in_progress(): + print('Cannot restart OpenVPN while a commit is in progress') + exit(1) call(f'systemctl restart openvpn@{interface}.service') else: print(f'OpenVPN interface "{interface}" does not exist!') -- cgit v1.2.3