mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-27 15:23:39 +00:00
Merge pull request #1002 from dwalton76/vtysh-exit-non-zero
vtysh: vtysh -f FOO should exit non-zero if it hits an error
This commit is contained in:
commit
82cc2e9dee
@ -1162,19 +1162,11 @@ if __name__ == '__main__':
|
|||||||
for line in lines_to_configure:
|
for line in lines_to_configure:
|
||||||
fh.write(line + '\n')
|
fh.write(line + '\n')
|
||||||
|
|
||||||
output = subprocess.check_output(['/usr/bin/vtysh', '-f', filename])
|
try:
|
||||||
|
subprocess.check_output(['/usr/bin/vtysh', '-f', filename])
|
||||||
# exit non-zero if we see these errors
|
except subprocess.CalledProcessError as e:
|
||||||
for x in ('BGP instance name and AS number mismatch',
|
log.warning("frr-reload.py failed due to\n%s" % e.output)
|
||||||
'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
|
reload_ok = False
|
||||||
|
|
||||||
os.unlink(filename)
|
os.unlink(filename)
|
||||||
|
|
||||||
# Make these changes persistent
|
# Make these changes persistent
|
||||||
|
@ -752,6 +752,7 @@ int vtysh_config_from_file(struct vty *vty, FILE *fp)
|
|||||||
lineno, cmd_stat,
|
lineno, cmd_stat,
|
||||||
vtysh_client[i].name,
|
vtysh_client[i].name,
|
||||||
vty->buf);
|
vty->buf);
|
||||||
|
retcode = cmd_stat;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user