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/restart_dhcp_relay.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/op_mode/restart_dhcp_relay.py') diff --git a/src/op_mode/restart_dhcp_relay.py b/src/op_mode/restart_dhcp_relay.py index af4fb2d15..db5a48970 100755 --- a/src/op_mode/restart_dhcp_relay.py +++ b/src/op_mode/restart_dhcp_relay.py @@ -24,6 +24,7 @@ import os import vyos.config from vyos.util import call +from vyos.util import commit_in_progress parser = argparse.ArgumentParser() @@ -39,6 +40,9 @@ if __name__ == '__main__': if not c.exists_effective('service dhcp-relay'): print("DHCP relay service not configured") else: + if commit_in_progress(): + print('Cannot restart DHCP relay while a commit is in progress') + exit(1) call('systemctl restart isc-dhcp-server.service') sys.exit(0) @@ -47,6 +51,9 @@ if __name__ == '__main__': if not c.exists_effective('service dhcpv6-relay'): print("DHCPv6 relay service not configured") else: + if commit_in_progress(): + print('Cannot restart DHCPv6 relay while commit is in progress') + exit(1) call('systemctl restart isc-dhcp-server6.service') sys.exit(0) -- cgit v1.2.3