summaryrefslogtreecommitdiff
path: root/src/op_mode/restart_dhcp_relay.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-07-07 19:49:07 +0200
committerGitHub <noreply@github.com>2022-07-07 19:49:07 +0200
commitff2665175fe58bff6f76f5ee57ebee6de838dbc5 (patch)
tree14ca1fe630f3ba4f7a0afdfd5c000037f1224dc5 /src/op_mode/restart_dhcp_relay.py
parent9403fda1e0a3bc0284a97b852f6501080523ffe5 (diff)
parent28ba0ef32425ee458293a37a4a5ba664dfe577b2 (diff)
downloadvyos-1x-ff2665175fe58bff6f76f5ee57ebee6de838dbc5.tar.gz
vyos-1x-ff2665175fe58bff6f76f5ee57ebee6de838dbc5.zip
Merge pull request #1397 from sever-sever/T4503
op-mode: T4503: Prevent restart service if commit in progress
Diffstat (limited to 'src/op_mode/restart_dhcp_relay.py')
-rwxr-xr-xsrc/op_mode/restart_dhcp_relay.py7
1 files changed, 7 insertions, 0 deletions
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)