task/internal: do not fail the script if systemd-sysusers core file not found 1641/head
authorKefu Chai <kchai@redhat.com>
Mon, 12 Apr 2021 05:16:10 +0000 (13:16 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 12 Apr 2021 05:16:11 +0000 (13:16 +0800)
commita7022fde0d38dd951724695f081795efed20c950
tree3b15a090b483f0d705b661e93a59dfad99071c46
parent6f07ce4b48995659fd9eb49b0d6483f39bc2e78d
task/internal: do not fail the script if systemd-sysusers core file not found

in 79f373c1769ea4f9d744cf33c5b0a0e026922d0f, we started to filter out
the systemd-sysusers core files. but the script fails if no such a file
is found, like:

2021-04-12T02:58:51.065 ERROR:teuthology.run_tasks:Manager failed: internal.coredump
Traceback (most recent call last):
  File "/home/teuthworker/src/git.ceph.com_git_teuthology_85d61eae4759f46ce21e9a37cd816a7a1a66c9d5/teuthology/run_tasks.py", line 176, in run_tasks
    suppress = manager.__exit__(*exc_info)
  File "/usr/lib/python3.6/contextlib.py", line 88, in __exit__
    next(self.gen)
  File "/home/teuthworker/src/git.ceph.com_git_teuthology_85d61eae4759f46ce21e9a37cd816a7a1a66c9d5/teuthology/task/internal/__init__.py", line 479, in coredump
    wait=False,
  File "/home/teuthworker/src/git.ceph.com_git_teuthology_85d61eae4759f46ce21e9a37cd816a7a1a66c9d5/teuthology/orchestra/run.py", line 479, in wait
    proc.wait()
  File "/home/teuthworker/src/git.ceph.com_git_teuthology_85d61eae4759f46ce21e9a37cd816a7a1a66c9d5/teuthology/orchestra/run.py", line 161, in wait
    self._raise_for_status()
  File "/home/teuthworker/src/git.ceph.com_git_teuthology_85d61eae4759f46ce21e9a37cd816a7a1a66c9d5/teuthology/orchestra/run.py", line 183, in _raise_for_status
    node=self.hostname, label=self.label
teuthology.exceptions.CommandFailedError: Command failed on smithi165 with status 1: "sudo sysctl -w kernel.core_pattern=core && sudo bash -c 'for f in `find /home/ubuntu/cephtest/archive/coredump
-type f`; do file $f | grep -q systemd-sysusers && rm $f ; done' && rmdir --ignore-fail-on-non-empty -- /home/ubuntu/cephtest/archive/coredump"

in this change, we ensure that the script never fails by adding `|| true`.

Signed-off-by: Kefu Chai <kchai@redhat.com>
teuthology/task/internal/__init__.py