summaryrefslogtreecommitdiff
path: root/src/helpers/vyos-boot-config-loader.py
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2020-03-12 14:15:12 -0500
committerJohn Estabrook <jestabro@vyos.io>2020-03-12 14:17:26 -0500
commitc776d43101dea36ec72e3b20dff314c9ad1e7079 (patch)
tree209a5acfc4a83b4c3a95997187c3bb53f0c2fac2 /src/helpers/vyos-boot-config-loader.py
parent3c4c7179ba40be6ccd418f22d3cee9b0e3c0f5e7 (diff)
downloadvyos-1x-c776d43101dea36ec72e3b20dff314c9ad1e7079.tar.gz
vyos-1x-c776d43101dea36ec72e3b20dff314c9ad1e7079.zip
[boot-config-loader] T1622: log traceback only if 'vyos-config-debug'
Diffstat (limited to 'src/helpers/vyos-boot-config-loader.py')
-rwxr-xr-xsrc/helpers/vyos-boot-config-loader.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/helpers/vyos-boot-config-loader.py b/src/helpers/vyos-boot-config-loader.py
index 7c81a4c3c..58483fe50 100755
--- a/src/helpers/vyos-boot-config-loader.py
+++ b/src/helpers/vyos-boot-config-loader.py
@@ -33,6 +33,8 @@ TRACE_FILE = '/tmp/boot-config-trace'
CFG_GROUP = 'vyattacfg'
+trace_config = False
+
if 'log' in directories:
LOG_DIR = directories['log']
else:
@@ -45,6 +47,9 @@ try:
cmdline = f.read()
if 'vyos-debug' in cmdline:
os.environ['VYOS_DEBUG'] = 'yes'
+ if 'vyos-config-debug' in cmdline:
+ os.environ['VYOS_DEBUG'] = 'yes'
+ trace_config = True
except Exception as e:
print('{0}'.format(e))
@@ -130,8 +135,9 @@ if __name__ == '__main__':
config_file = f.read()
except Exception:
write_config_status(1)
- failsafe(default_file_name)
- trace_to_file(TRACE_FILE)
+ if trace_config:
+ failsafe(default_file_name)
+ trace_to_file(TRACE_FILE)
sys.exit(1)
try:
@@ -146,8 +152,9 @@ if __name__ == '__main__':
# If here, there is no use doing session.discard, as we have no
# recoverable config environment, and will only throw an error
write_config_status(1)
- failsafe(default_file_name)
- trace_to_file(TRACE_FILE)
+ if trace_config:
+ failsafe(default_file_name)
+ trace_to_file(TRACE_FILE)
sys.exit(1)
time_elapsed_load = time_end_load - time_begin_load