diff options
author | John Estabrook <jestabro@vyos.io> | 2023-10-11 10:05:53 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-11 10:05:53 -0500 |
commit | 759c2d8afd09e394253fa09ae86cb2e97cc8a391 (patch) | |
tree | b3480e339299d85e6a9e72f0ca4e133745155cca /src/conf_mode/http-api.py | |
parent | 7720ee247c03eeeab895da27804996571ffb476b (diff) | |
parent | 9c7a4b43278e2da0c423089100fb0878239e0aa6 (diff) | |
download | vyos-1x-759c2d8afd09e394253fa09ae86cb2e97cc8a391.tar.gz vyos-1x-759c2d8afd09e394253fa09ae86cb2e97cc8a391.zip |
Merge pull request #2354 from vyos/mergify/bp/sagitta/pr-2352
http-api: T2612: correct the response message and add reload for api self-configuration (backport #2352)
Diffstat (limited to 'src/conf_mode/http-api.py')
-rwxr-xr-x | src/conf_mode/http-api.py | 6 |
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}') |