diff options
author | Daniel Walton <dwalton@cumulusnetworks.com> | 2017-08-16 22:22:59 +0200 |
---|---|---|
committer | Daniel Walton <dwalton@cumulusnetworks.com> | 2017-08-16 22:22:59 +0200 |
commit | 596074af62ebe33bcccfd910c7ca727ce4bbf409 (patch) | |
tree | a53f3f1f539557fe7457b83420f9f087778b6b36 /tools | |
parent | Merge pull request #985 from chiragshah6/mdev2 (diff) | |
download | frr-596074af62ebe33bcccfd910c7ca727ce4bbf409.tar.xz frr-596074af62ebe33bcccfd910c7ca727ce4bbf409.zip |
vtysh: vtysh -f FOO should exit non-zero if it hits an error
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Today if we hit an error while apply the contents of file FOO that error
does not bubble up to a non-zero exit.
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/frr-reload.py | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/tools/frr-reload.py b/tools/frr-reload.py index 43496d4cb..8556f0b46 100755 --- a/tools/frr-reload.py +++ b/tools/frr-reload.py @@ -1162,19 +1162,11 @@ if __name__ == '__main__': for line in lines_to_configure: fh.write(line + '\n') - output = subprocess.check_output(['/usr/bin/vtysh', '-f', filename]) - - # exit non-zero if we see these errors - for x in ('BGP instance name and AS number mismatch', - 'BGP instance is already running', - '% not a local address'): - for line in output.splitlines(): - if x in line: - msg = "ERROR: %s" % x - log.error(msg) - print msg - reload_ok = False - + try: + subprocess.check_output(['/usr/bin/vtysh', '-f', filename]) + except subprocess.CalledProcessError as e: + log.warning("frr-reload.py failed due to\n%s" % e.output) + reload_ok = False os.unlink(filename) # Make these changes persistent |