]> git.puffer.fish Git - mirror/frr.git/commitdiff
vtysh: vtysh -f FOO should exit non-zero if it hits an error 1002/head
authorDaniel Walton <dwalton@cumulusnetworks.com>
Wed, 16 Aug 2017 20:22:59 +0000 (20:22 +0000)
committerDaniel Walton <dwalton@cumulusnetworks.com>
Wed, 16 Aug 2017 20:22:59 +0000 (20:22 +0000)
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.

tools/frr-reload.py
vtysh/vtysh.c

index 43496d4cbfebc64610d0beddb1c8b74dba370809..8556f0b46e4858273dae854945ea8c62982750a5 100755 (executable)
@@ -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
index f971c171bc328afcc5dfbab5b8bc2c033cf98570..f7bfd9e42e095b4c2c56142c7960afdf29886259 100644 (file)
@@ -752,6 +752,7 @@ int vtysh_config_from_file(struct vty *vty, FILE *fp)
                                                        lineno, cmd_stat,
                                                        vtysh_client[i].name,
                                                        vty->buf);
+                                               retcode = cmd_stat;
                                                break;
                                        }
                                }