mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-10 10:49:01 +00:00
Merge pull request #7125 from qlyoung/what-the-frick-robert
tools: fix vtysh failure error handling
This commit is contained in:
commit
b0164b18eb
@ -128,17 +128,13 @@ class Vtysh(object):
|
|||||||
% (child.returncode))
|
% (child.returncode))
|
||||||
|
|
||||||
def mark_file(self, filename, stdin=None):
|
def mark_file(self, filename, stdin=None):
|
||||||
kwargs = {}
|
|
||||||
if stdin is not None:
|
|
||||||
kwargs['stdin'] = stdin
|
|
||||||
|
|
||||||
child = self._call(['-m', '-f', filename],
|
child = self._call(['-m', '-f', filename],
|
||||||
stdout=subprocess.PIPE, **kwargs)
|
stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
try:
|
try:
|
||||||
stdout, stderr = child.communicate()
|
stdout, stderr = child.communicate()
|
||||||
except subprocess.TimeoutExpired:
|
except subprocess.TimeoutExpired:
|
||||||
child.kill()
|
child.kill()
|
||||||
stdout, stderr = proc.communicate()
|
stdout, stderr = child.communicate()
|
||||||
raise VtyshException('vtysh call timed out!')
|
raise VtyshException('vtysh call timed out!')
|
||||||
|
|
||||||
if child.wait() != 0:
|
if child.wait() != 0:
|
||||||
@ -1313,8 +1309,12 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
# Create a Config object from the config generated by newconf
|
# Create a Config object from the config generated by newconf
|
||||||
newconf = Config(vtysh)
|
newconf = Config(vtysh)
|
||||||
newconf.load_from_file(args.filename)
|
try:
|
||||||
reload_ok = True
|
newconf.load_from_file(args.filename)
|
||||||
|
reload_ok = True
|
||||||
|
except VtyshException as ve:
|
||||||
|
log.error("vtysh failed to process new configuration: {}".format(ve))
|
||||||
|
reload_ok = False
|
||||||
|
|
||||||
if args.test:
|
if args.test:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user