summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2021-03-16 10:32:52 -0500
committerJohn Estabrook <jestabro@vyos.io>2021-03-16 10:32:52 -0500
commit27d6b5a3b3bf0c617115e6de11cff778286c781f (patch)
tree960211b325891dd494d8d05b2181d80d20a05490
parenta340f27512e71b5d5730be44b53768e1b7aee7f8 (diff)
downloadvyos-1x-27d6b5a3b3bf0c617115e6de11cff778286c781f.tar.gz
vyos-1x-27d6b5a3b3bf0c617115e6de11cff778286c781f.zip
configd: T3411: revert to using explicit_print on ConfigError
-rwxr-xr-xsrc/services/vyos-configd9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/services/vyos-configd b/src/services/vyos-configd
index 1e60e53df..f06711831 100755
--- a/src/services/vyos-configd
+++ b/src/services/vyos-configd
@@ -108,6 +108,12 @@ conf_mode_scripts = dict(zip(imports, modules))
exclude_set = {key_name_from_file_name(f) for f in filenames if f not in include}
include_set = {key_name_from_file_name(f) for f in filenames if f in include}
+def explicit_print(path, mode, msg):
+ try:
+ with open(path, mode) as f:
+ f.write(f"\n{msg}\n\n")
+ except OSError:
+ logger.critical("error explicit_print")
def run_script(script, config) -> int:
config.set_level([])
@@ -120,8 +126,7 @@ def run_script(script, config) -> int:
script.apply(c)
except ConfigError as e:
logger.critical(e)
- with open(session_out, session_mode) as f, redirect_stdout(f):
- print(f"{e}\n")
+ explicit_print(session_out, session_mode, str(e))
return R_ERROR_COMMIT
except Exception as e:
logger.critical(e)