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/clear_dhcp_lease.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/op_mode/clear_dhcp_lease.py') diff --git a/src/op_mode/clear_dhcp_lease.py b/src/op_mode/clear_dhcp_lease.py index 6ac3d4c1c..250dbcce1 100755 --- a/src/op_mode/clear_dhcp_lease.py +++ b/src/op_mode/clear_dhcp_lease.py @@ -9,6 +9,7 @@ from isc_dhcp_leases import IscDhcpLeases from vyos.configquery import ConfigTreeQuery from vyos.util import ask_yes_no from vyos.util import call +from vyos.util import commit_in_progress config = ConfigTreeQuery() @@ -66,6 +67,10 @@ if __name__ == '__main__': if not is_ip_in_leases(address): exit(1) + if commit_in_progress(): + print('Cannot clear DHCP lease while a commit is in progress') + exit(1) + if not ask_yes_no(f'This will restart DHCP server.\nContinue?'): exit(1) else: -- cgit v1.2.3