summaryrefslogtreecommitdiff
path: root/src/services/api/rest/routers.py
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2025-05-28 14:05:23 -0500
committerJohn Estabrook <jestabro@vyos.io>2025-05-28 15:35:16 -0500
commit0464fc0dd9c62beff242ec024086fb57947469c0 (patch)
tree291e422c9142e898e5000d9ff57075432b549e58 /src/services/api/rest/routers.py
parenta81ab0c6808080f521bfb673c61f90a744c625ff (diff)
downloadvyos-1x-0464fc0dd9c62beff242ec024086fb57947469c0.tar.gz
vyos-1x-0464fc0dd9c62beff242ec024086fb57947469c0.zip
http-api: T7498: allow passing config string in body of 'load' request
Diffstat (limited to 'src/services/api/rest/routers.py')
-rw-r--r--src/services/api/rest/routers.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/services/api/rest/routers.py b/src/services/api/rest/routers.py
index e52c77fda..8679329da 100644
--- a/src/services/api/rest/routers.py
+++ b/src/services/api/rest/routers.py
@@ -510,8 +510,12 @@ def config_file_op(data: ConfigFileModel, background_tasks: BackgroundTasks):
elif op == 'load':
if data.file:
path = data.file
+ elif data.string:
+ path = '/tmp/config.file'
+ with open(path, 'w') as f:
+ f.write(data.string)
else:
- return error(400, 'Missing required field "file"')
+ return error(400, 'Missing required field "file | string"')
session.migrate_and_load_config(path)