From: Kefu Chai Date: Mon, 12 Apr 2021 05:16:10 +0000 (+0800) Subject: task/internal: do not fail the script if systemd-sysusers core file not found X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=a7022fde0d38dd951724695f081795efed20c950;p=teuthology.git 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 --- diff --git a/teuthology/task/internal/__init__.py b/teuthology/task/internal/__init__.py index e4e4610905..e96a9ff8a6 100644 --- a/teuthology/task/internal/__init__.py +++ b/teuthology/task/internal/__init__.py @@ -469,7 +469,7 @@ def coredump(ctx, config): run.Raw('&&'), 'sudo', 'bash', '-c', (f'for f in `find {archive_dir}/coredump -type f`; do ' - 'file $f | grep -q systemd-sysusers && rm $f ; ' + 'file $f | grep -q systemd-sysusers && rm $f || true ; ' 'done'), run.Raw('&&'), # don't litter the archive dir if there were no cores dumped