diff options
author | John Estabrook <jestabro@vyos.io> | 2022-01-10 11:34:04 -0600 |
---|---|---|
committer | John Estabrook <jestabro@vyos.io> | 2022-01-10 16:55:55 -0600 |
commit | cb797395a4df6b0b7a192e9e1f25427f921fac06 (patch) | |
tree | 603850b7cbb938f09cb3f21c1e59643518f10f8c /python | |
parent | bb76e8d7f16355b140a60feafbbed67774788343 (diff) | |
download | vyos-1x-cb797395a4df6b0b7a192e9e1f25427f921fac06.tar.gz vyos-1x-cb797395a4df6b0b7a192e9e1f25427f921fac06.zip |
frr: T4166: move log debug setting to init function for vyos-configd
frr.py debugging is set True if the file '/tmp/vyos.frr.debug' exists;
this check needs to be called within an init function, as frr.py will
have already been loaded by vyos-configd before the /tmp/*.debug files
are created by vyos-router, or by call to 'touch'.
Diffstat (limited to 'python')
-rw-r--r-- | python/vyos/frr.py | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/python/vyos/frr.py b/python/vyos/frr.py index a8f115d9a..cbba19ab7 100644 --- a/python/vyos/frr.py +++ b/python/vyos/frr.py @@ -73,15 +73,15 @@ from vyos.util import cmd import logging from logging.handlers import SysLogHandler import os +import sys + LOG = logging.getLogger(__name__) +DEBUG = False -DEBUG = os.path.exists('/tmp/vyos.frr.debug') -if DEBUG: - LOG.setLevel(logging.DEBUG) - ch = SysLogHandler(address='/dev/log') - ch2 = logging.StreamHandler() - LOG.addHandler(ch) - LOG.addHandler(ch2) +ch = SysLogHandler(address='/dev/log') +ch2 = logging.StreamHandler(stream=sys.stdout) +LOG.addHandler(ch) +LOG.addHandler(ch2) _frr_daemons = ['zebra', 'bgpd', 'fabricd', 'isisd', 'ospf6d', 'ospfd', 'pbrd', 'pimd', 'ripd', 'ripngd', 'sharpd', 'staticd', 'vrrpd', 'ldpd', @@ -121,6 +121,12 @@ class ConfigSectionNotFound(FrrError): """ pass +def init_debugging(): + global DEBUG + + DEBUG = os.path.exists('/tmp/vyos.frr.debug') + if DEBUG: + LOG.setLevel(logging.DEBUG) def get_configuration(daemon=None, marked=False): """ Get current running FRR configuration @@ -424,6 +430,8 @@ class FRRConfig: Using this overwrites the current loaded config objects and replaces the original loaded config ''' + init_debugging() + self.imported_config = get_configuration(daemon=daemon) if daemon: LOG.debug(f'load_configuration: Configuration loaded from FRR daemon {daemon}') |