summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDaniel Walton <dwalton@cumulusnetworks.com>2016-09-27 17:56:36 +0200
committerDaniel Walton <dwalton@cumulusnetworks.com>2016-09-27 18:00:47 +0200
commit8d62b1417ee85862a85454f635168e5e3fcf682d (patch)
tree587aa53c9851dde9b726e299fdebe84a9d454931 /tools
parentbgpd: resolve memory leaks in "show ip bgp neighbor json" (diff)
downloadfrr-8d62b1417ee85862a85454f635168e5e3fcf682d.tar.xz
frr-8d62b1417ee85862a85454f635168e5e3fcf682d.zip
tools: quagga-reload should raise Exception instead of exiting
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com> Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com> NCLU imports quagga-reload.py and uses its Config class to parse Quagga.conf. The Config class will call 'vtysh -m -f Quagga.conf" and if that exited with an error Config would call sys.exit(1) which in my cases causes the NCLU daemon to exit which is bad. The fix is to have the Config class raise an exception instead of exiting, then NCLU can catch the exception, log it and move on. (cherry picked from commit 276887bb1c2961fa37b42ce7160346f1417577a8)
Diffstat (limited to 'tools')
-rwxr-xr-xtools/quagga-reload.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/tools/quagga-reload.py b/tools/quagga-reload.py
index 900ed55c4..ed36b940a 100755
--- a/tools/quagga-reload.py
+++ b/tools/quagga-reload.py
@@ -26,6 +26,10 @@ from pprint import pformat
log = logging.getLogger(__name__)
+class VtyshMarkException(Exception):
+ pass
+
+
class Context(object):
"""
@@ -88,9 +92,7 @@ class Config(object):
try:
file_output = subprocess.check_output(['/usr/bin/vtysh', '-m', '-f', filename])
except subprocess.CalledProcessError as e:
- log.error('vtysh marking of config file %s failed with error %s:', filename, str(e))
- print "vtysh marking of file %s failed with error: %s" % (filename, str(e))
- sys.exit(1)
+ raise VtyshMarkException(str(e))
for line in file_output.split('\n'):
line = line.strip()
@@ -115,9 +117,7 @@ class Config(object):
"/usr/bin/vtysh -c 'show run' | /usr/bin/tail -n +4 | /usr/bin/vtysh -m -f -",
shell=True)
except subprocess.CalledProcessError as e:
- log.error('vtysh marking of running config failed with error %s:', str(e))
- print "vtysh marking of running config failed with error %s:" % (str(e))
- sys.exit(1)
+ raise VtyshMarkException(str(e))
for line in config_text.split('\n'):
line = line.strip()