diff options
author | John Estabrook <jestabro@vyos.io> | 2023-10-06 22:27:19 -0500 |
---|---|---|
committer | John Estabrook <jestabro@vyos.io> | 2023-10-09 11:18:38 -0500 |
commit | 93d2ea7d635c7aa5acf3000654393ea48b7c6405 (patch) | |
tree | bbc49127aad862d2d345d9940849b58359f3a56b /src/conf_mode | |
parent | 7d597a6dca15cb592230b349ef7ef565f258cf43 (diff) | |
download | vyos-1x-93d2ea7d635c7aa5acf3000654393ea48b7c6405.tar.gz vyos-1x-93d2ea7d635c7aa5acf3000654393ea48b7c6405.zip |
http-api: T2612: reload server within configsession for api self-config
Diffstat (limited to 'src/conf_mode')
-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}') |