summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2023-10-10 19:11:20 +0100
committerGitHub <noreply@github.com>2023-10-10 19:11:20 +0100
commitf48727eee9cb6a1d20c2f6814359fc34af51a7b0 (patch)
treea2805d326b731e703fb80cc027127aa06a8157b9 /src/conf_mode
parent9ceba9ede21f4f89bd0b4ee614178b82cddb7d41 (diff)
parent93d2ea7d635c7aa5acf3000654393ea48b7c6405 (diff)
downloadvyos-1x-f48727eee9cb6a1d20c2f6814359fc34af51a7b0.tar.gz
vyos-1x-f48727eee9cb6a1d20c2f6814359fc34af51a7b0.zip
Merge pull request #2352 from jestabro/api-self-config
http-api: T2612: correct the response message and add reload for api self-configuration
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/http-api.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/conf_mode/http-api.py b/src/conf_mode/http-api.py
index 793a90d88..d8fe3b736 100755
--- a/src/conf_mode/http-api.py
+++ b/src/conf_mode/http-api.py
@@ -27,6 +27,7 @@ from vyos.config import Config
from vyos.configdep import set_dependents, call_dependents
from vyos.template import render
from vyos.utils.process import call
+from vyos.utils.process import is_systemd_service_running
from vyos import ConfigError
from vyos import airbag
airbag.enable()
@@ -130,7 +131,10 @@ def apply(http_api):
service_name = 'vyos-http-api.service'
if http_api is not None:
- call(f'systemctl restart {service_name}')
+ if is_systemd_service_running(f'{service_name}'):
+ call(f'systemctl reload {service_name}')
+ else:
+ call(f'systemctl restart {service_name}')
else:
call(f'systemctl stop {service_name}')