mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 14:05:31 +00:00
tests: Topotests fix for deleting wrong pidfile
Fixes killRouterDaemons() function which occasionally deleted the wrong pidfile. Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
This commit is contained in:
parent
65a78243d8
commit
6c5045ce4f
@ -1888,15 +1888,16 @@ class Router(Node):
|
|||||||
# Exclude empty string at end of list
|
# Exclude empty string at end of list
|
||||||
for d in dmns[:-1]:
|
for d in dmns[:-1]:
|
||||||
if re.search(r"%s" % daemon, d):
|
if re.search(r"%s" % daemon, d):
|
||||||
daemonpid = self.cmd("cat %s" % d.rstrip()).rstrip()
|
daemonpidfile = d.rstrip()
|
||||||
|
daemonpid = self.cmd("cat %s" % daemonpidfile).rstrip()
|
||||||
if daemonpid.isdigit() and pid_exists(int(daemonpid)):
|
if daemonpid.isdigit() and pid_exists(int(daemonpid)):
|
||||||
logger.info(
|
logger.info(
|
||||||
"{}: killing {}".format(
|
"{}: killing {}".format(
|
||||||
self.name,
|
self.name,
|
||||||
os.path.basename(d.rstrip().rsplit(".", 1)[0]),
|
os.path.basename(daemonpidfile.rsplit(".", 1)[0]),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
self.cmd("kill -9 %s" % daemonpid)
|
os.kill(int(daemonpid), signal.SIGKILL)
|
||||||
if pid_exists(int(daemonpid)):
|
if pid_exists(int(daemonpid)):
|
||||||
numRunning += 1
|
numRunning += 1
|
||||||
while wait and numRunning > 0:
|
while wait and numRunning > 0:
|
||||||
@ -1922,12 +1923,12 @@ class Router(Node):
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
self.cmd("kill -9 %s" % daemonpid)
|
os.kill(int(daemonpid), signal.SIGKILL)
|
||||||
if daemonpid.isdigit() and not pid_exists(
|
if daemonpid.isdigit() and not pid_exists(
|
||||||
int(daemonpid)
|
int(daemonpid)
|
||||||
):
|
):
|
||||||
numRunning -= 1
|
numRunning -= 1
|
||||||
self.cmd("rm -- {}".format(d.rstrip()))
|
self.cmd("rm -- {}".format(daemonpidfile))
|
||||||
if wait:
|
if wait:
|
||||||
errors = self.checkRouterCores(reportOnce=True)
|
errors = self.checkRouterCores(reportOnce=True)
|
||||||
if self.checkRouterVersion("<", minErrorVersion):
|
if self.checkRouterVersion("<", minErrorVersion):
|
||||||
|
Loading…
Reference in New Issue
Block a user