diff options
author | John Estabrook <jestabro@vyos.io> | 2024-09-20 20:46:24 -0500 |
---|---|---|
committer | John Estabrook <jestabro@vyos.io> | 2024-09-22 09:19:57 -0500 |
commit | 5034db86b8c43846475e9876116e55a189fe7d06 (patch) | |
tree | dd4603b8149e18fa557ed2fa9cf87fec3ec21d30 | |
parent | 644a91e970c96de01d2e17a7ea91502b8f7265e6 (diff) | |
download | vyos-1x-5034db86b8c43846475e9876116e55a189fe7d06.tar.gz vyos-1x-5034db86b8c43846475e9876116e55a189fe7d06.zip |
configd: T6608: report uncaught config script exceptions as commit error
In the case of config mode script exceptions other than ConfigError,
vyos-configd would previously trigger the shim to re-run the script in
the CLI context. The use of config dependencies require this case to
return a commit error. A traceback is returned as output, consistent
with running without vyos-configd support.
-rwxr-xr-x | src/services/vyos-configd | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/services/vyos-configd b/src/services/vyos-configd index 2c0244a81..cb23642dc 100755 --- a/src/services/vyos-configd +++ b/src/services/vyos-configd @@ -24,6 +24,7 @@ import json import typing import logging import signal +import traceback import importlib.util import io from contextlib import redirect_stdout @@ -136,9 +137,10 @@ def run_script(script_name, config, args) -> tuple[int, str]: except ConfigError as e: logger.error(e) return R_ERROR_COMMIT, str(e) - except Exception as e: - logger.critical(e) - return R_ERROR_DAEMON, str(e) + except Exception: + tb = traceback.format_exc() + logger.error(tb) + return R_ERROR_COMMIT, tb return R_SUCCESS, '' |