scylla_coredump_setup: Remove the coredump create by the check

We generate a coredump as part of "scylla_coredump_setup" to verify that
coredumps are working. However, we need to *remove* that test coredump
to avoid people and test infrastructure reporting those coredumps.

Fixes #6159
This commit is contained in:
Israel Fruchter
2020-04-16 15:15:31 +03:00
committed by Pekka Enberg
parent bdd0fcd0b7
commit 28c3d4f8e8

View File

@@ -100,6 +100,12 @@ WantedBy=multi-user.target
try:
run('coredumpctl --no-pager --no-legend info {}'.format(pid))
print('\nsystemd-coredump is working finely.')
# get last coredump generated by bash and remove it, ignore inaccessaible ones
corefile = out('coredumpctl -1 --no-legend dump 2>&1 | grep "bash" | grep "Storage:\|Coredump:" | grep -v "inaccessible"')
if corefile:
corefile = corefile.split()[-1]
run('rm -f {}'.format(corefile))
except subprocess.CalledProcessError as e:
print('Does not able to detect coredump, failed to configure systemd-coredump.')
sys.exit(1)