Skip to content

Commit

Permalink
configd: T6608: report uncaught config script exceptions as commit error
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jestabro committed Sep 22, 2024
1 parent 644a91e commit 5034db8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/services/vyos-configd
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import json
import typing
import logging
import signal
import traceback
import importlib.util
import io
from contextlib import redirect_stdout
Expand Down Expand Up @@ -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, ''

Expand Down

0 comments on commit 5034db8

Please sign in to comment.