diff options
author | Christian Poessinger <christian@poessinger.com> | 2022-07-07 19:49:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-07 19:49:07 +0200 |
commit | ff2665175fe58bff6f76f5ee57ebee6de838dbc5 (patch) | |
tree | 14ca1fe630f3ba4f7a0afdfd5c000037f1224dc5 /src/op_mode/flow_accounting_op.py | |
parent | 9403fda1e0a3bc0284a97b852f6501080523ffe5 (diff) | |
parent | 28ba0ef32425ee458293a37a4a5ba664dfe577b2 (diff) | |
download | vyos-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/flow_accounting_op.py')
-rwxr-xr-x | src/op_mode/flow_accounting_op.py | 7 |
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') |