summaryrefslogtreecommitdiff
path: root/src/op_mode/flow_accounting_op.py
diff options
context:
space:
mode:
authorViacheslav Hletenko <v.gletenko@vyos.io>2022-07-06 15:32:42 +0000
committerViacheslav Hletenko <v.gletenko@vyos.io>2022-07-07 16:28:59 +0000
commit28ba0ef32425ee458293a37a4a5ba664dfe577b2 (patch)
tree9e6847a82ca668e874a3ad3cd763370be1f8dab9 /src/op_mode/flow_accounting_op.py
parentc548d1c7bac049c2a309bb3afac3694009a25b5f (diff)
downloadvyos-1x-28ba0ef32425ee458293a37a4a5ba664dfe577b2.tar.gz
vyos-1x-28ba0ef32425ee458293a37a4a5ba664dfe577b2.zip
op-mode: T4503: Prevent restart service if commit in progress
Prevent op-mode scripts from restarting services if commit in progress
Diffstat (limited to 'src/op_mode/flow_accounting_op.py')
-rwxr-xr-xsrc/op_mode/flow_accounting_op.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/op_mode/flow_accounting_op.py b/src/op_mode/flow_accounting_op.py
index 6586cbceb..514143cd7 100755
--- a/src/op_mode/flow_accounting_op.py
+++ b/src/op_mode/flow_accounting_op.py
@@ -22,7 +22,9 @@ import ipaddress
import os.path
from tabulate import tabulate
from json import loads
-from vyos.util import cmd, run
+from vyos.util import cmd
+from vyos.util import commit_in_progress
+from vyos.util import run
from vyos.logger import syslog
# some default values
@@ -224,6 +226,9 @@ if not _uacctd_running():
# restart pmacct daemon
if cmd_args.action == 'restart':
+ if commit_in_progress():
+ print('Cannot restart flow-accounting while a commit is in progress')
+ exit(1)
# run command to restart flow-accounting
cmd('systemctl restart uacctd.service',
message='Failed to restart flow-accounting')