diff options
author | John Estabrook <jestabro@vyos.io> | 2024-09-19 12:27:28 -0500 |
---|---|---|
committer | John Estabrook <jestabro@vyos.io> | 2024-09-20 11:35:30 -0500 |
commit | 8e902ffa7019d2e2c0849af6fd26461ca4abba16 (patch) | |
tree | c29904fa541d5496729ed7f480e87c2d54d393fd /src/services/vyos-http-api-server | |
parent | 394c2ad60b9d78b516facd9509493f719643323c (diff) | |
download | vyos-1x-8e902ffa7019d2e2c0849af6fd26461ca4abba16.tar.gz vyos-1x-8e902ffa7019d2e2c0849af6fd26461ca4abba16.zip |
http-api: T6326: return full warning/error output through api
Configuration error output is not returned in full to the http-api when
running under vyos-configd, due to an early implementation 'workaround'
of vyos-configd writing directly to the session tty. This is corrected
to return all ambient stdout (notably vyos.base.Warning) and error
messages directly to the originating caller, which may be from a session
tty or a ConfigSession instance. As the http-api runs in the latter
case, the full output is returned.
Diffstat (limited to 'src/services/vyos-http-api-server')
-rwxr-xr-x | src/services/vyos-http-api-server | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/services/vyos-http-api-server b/src/services/vyos-http-api-server index 97633577d..91100410c 100755 --- a/src/services/vyos-http-api-server +++ b/src/services/vyos-http-api-server @@ -577,7 +577,9 @@ def _configure_op(data: Union[ConfigureModel, ConfigureListModel, background_tasks.add_task(call_commit, session) msg = self_ref_msg else: - session.commit() + # capture non-fatal warnings + out = session.commit() + msg = out if out else msg logger.info(f"Configuration modified via HTTP API using key '{app.state.vyos_id}'") except ConfigSessionError as e: |