summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2022-12-02 11:22:43 -0600
committerJohn Estabrook <jestabro@vyos.io>2022-12-02 11:22:43 -0600
commit579e9294075d82627997af41ac7895923c7e8d5d (patch)
tree01df16653d4e2af609930d0a846ec46585747d66
parentc2a5957a942c8f6070b8f6ff12764e90c1a4c237 (diff)
downloadvyos-1x-579e9294075d82627997af41ac7895923c7e8d5d.tar.gz
vyos-1x-579e9294075d82627997af41ac7895923c7e8d5d.zip
http-api: T4859: correct calling of script dependencies from http-api.py
-rw-r--r--data/config-mode-dependencies.json1
-rwxr-xr-xsrc/conf_mode/http-api.py8
2 files changed, 8 insertions, 1 deletions
diff --git a/data/config-mode-dependencies.json b/data/config-mode-dependencies.json
index ad12cff87..9e943ba2c 100644
--- a/data/config-mode-dependencies.json
+++ b/data/config-mode-dependencies.json
@@ -1,5 +1,6 @@
{
"firewall": {"group_resync": ["nat", "policy-route"]},
+ "http_api": {"https": ["https"]},
"pki": {
"ethernet": ["interfaces-ethernet"],
"openvpn": ["interfaces-openvpn"],
diff --git a/src/conf_mode/http-api.py b/src/conf_mode/http-api.py
index be80613c6..6328294c1 100755
--- a/src/conf_mode/http-api.py
+++ b/src/conf_mode/http-api.py
@@ -25,6 +25,7 @@ import vyos.defaults
from vyos.config import Config
from vyos.configdict import dict_merge
+from vyos.configdep import set_dependents, call_dependents
from vyos.template import render
from vyos.util import cmd
from vyos.util import call
@@ -61,6 +62,11 @@ def get_config(config=None):
else:
conf = Config()
+ # reset on creation/deletion of 'api' node
+ https_base = ['service', 'https']
+ if conf.exists(https_base):
+ set_dependents("https", conf)
+
base = ['service', 'https', 'api']
if not conf.exists(base):
return None
@@ -132,7 +138,7 @@ def apply(http_api):
# Let uvicorn settle before restarting Nginx
sleep(1)
- cmd(f'{vyos_conf_scripts_dir}/https.py', raising=ConfigError)
+ call_dependents()
if __name__ == '__main__':
try: